Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ames!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!usc!snorkelwacker!mintaka!ogicse!decwrl!ucbvax!hplabs!hpfcso!stroyan From: stroyan@hpfcso.HP.COM (Mike Stroyan) Newsgroups: comp.windows.x Subject: Re: Checking for valid Window ID Message-ID: <7320006@hpfcso.HP.COM> Date: 16 Mar 90 21:35:02 GMT References: <24321@uhnix1.uh.edu> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 17 > > My program has the Window ID of a window on a remote display. I > > wish to check whether or not the ID is valid (that is, whether the > > window still exists), before doing an XSendEvent. > > You should send the event without checking. Install an error handler > to catch any BadWindow errors indicating that the window no longer > exists. Since X is shared and asynchronous, there is no guarantee that > a window that existed when you did your check will still exist when you > send the event. > > Ken Lee Of course, there is also no guarantee that the window id won't be free'd and reallocated to another client's new window. Sometimes things like this make me want to just XGrabServer and never let go. Mike Stroyan, stroyan@hpfcla.hp.com