home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!yale.edu!yale!mintaka.lcs.mit.edu!hal!brself
- From: brself@hal.gnu.ai.mit.edu (Ben Self)
- Subject: Trapping BadWindow Errors?
- Message-ID: <brself.712270104@hal>
- Sender: news@mintaka.lcs.mit.edu
- Organization: MIT Laboratory for Computer Science
- Date: Mon, 27 Jul 1992 20:48:24 GMT
- Lines: 39
-
-
- When I began looking for ways to safe-guard my communications sent via
- XSendEvent I ran acrossed the following entry in XFAQ:
-
- > ----------------------------------------------------------------------
- > Subject: 132) How do I check whether a window ID is valid?
- > My program has the ID of a window on a remote display. I want to check whether
- > the window exists before doing anything with it.
- >
- > Because X is asynchronous, there isn't a guarantee that the window
- > would still exist between the time that you got the ID and the time you sent
- > an event to the window or otherwise manipulated it. What you should do is send
- > the event without checking, but install an error handler to catch any
- > BadWindow errors, which would indicate that the window no longer exists.
- > This scheme will work except on the [rare] occasion that the original window
- > has been destroyed and its ID reallocated to another window.
- >
- > [courtesy Ken Lee (klee@wsl.dec.com), 4/90]
- >
- > ----------------------------------------------------------------------
-
- This is a great suggestion; unfortunately, the documentation for the XError
- interfaces is frightfully *unclear* and *unspecific*.
-
- Could someone please outline the specifics that are required to trap
- BadWindow Errors (preferably from a given widget or procedure)
-
- and tell me which of the various error interface mechanisms are involved:
-
- Xt:
- XtAppErrorMsg
- XtAppError
-
- Xlib:
- XSetErrorHandler
- XSetIOErrorHandler
-
-
- Great appreciation in advance (I bow to the wizards of all they survey)
-