Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU Newsgroups: comp.windows.x Subject: Re: XSetErrorHandler and access to _XPrintDefaultError routine. Message-ID: <9102071205.AA10739@lightning.McRCIM.McGill.EDU> Date: 7 Feb 91 12:05:08 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 37 > I had a need to set up an error handler via XSetErrorHandler to trap > Xerrors so that my application ([...]) could kill the parent process > before exiting; otherwise the parent process would hang around > indefinitely. I really wanted to duplicate the error diagnostic > reported by mit/lib/X/XlibInt.c/_XPrintDefaultError(), but as far as > I know it is unadvertised, therefore unsupported. For now, I am > using it with compiler flags configurable in the makefile ready to > punt if it becomes unavailable. > Can someone at MIT advise me on this, or consider promoting it to a > documented Xlib entry point in R5? Well, I'm not at MIT, but perhaps I'll do :-) You don't need a documented entry point. Instead, save the pointer returned by XSetErrorHandler and call through that to get what you want. That is, your error handler should look something like int (*prevhand)(); /* pointer to previous handler */ errhand(disp,ev) Display *disp; XErrorEvent *ev; { ...look at things, perhaps return if you want to ignore the error, perhaps kill off your other process... (*prevhand)(disp,ev); /* call previous handler */ } ...and in your setup code, prevhand = XSetErrorHandler(errhand); /* install our handler */ der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu