[comp.windows.x] XSetErrorHandler question

kaleb@THYME.JPL.NASA.GOV (Kaleb Keithley) (08/29/90)

Consider the following (psuedo code):

nonFatalErrorHandler (...) {...}

main (...) {
XOpenDisplay (...);
XSetErrorHandler (nonFatalErrorHandler);
InitializeClientMessageEvent (...);
for (loop = 0; loop < 100; loop++) {
  XSendEvent (...); /* to an invalid window ID */
  XSync (...);
}
XCloseDisplay (...)
}

In the above sample, the error handler gets called once for each event sent 
to an invalid window.  But in my real program I am seeing the error handler 
called once for every four or five events sent to invalid windows.

Is this behaviour normal?  The O'Reilly Reference has little to say on the
subject.  I looked at the source, but I'm sorry to say, I couldn't draw any
conclusions from that.

-- 
Kaleb Keithley                      Jet Propeller Labs
kaleb@thyme.jpl.nasa.gov

"So that's what an invisible barrier looks like!"

klee@wsl.dec.com (Ken Lee) (08/31/90)

In article <9008291546.AA05946@thyme.jpl.nasa.gov>, kaleb@THYME.JPL.NASA.GOV
(Kaleb Keithley) writes:
|> But in my real program I am seeing the error handler 
|> called once for every four or five events sent to invalid windows.

Unless you're doing something weird, like creating new Xlib errors
inside Xlib error handlers or signal handlers, Xlib should report every
error to you.  A test program I wrote (using DECwindows Ultrix Xlib)
correctly caught each of 100 errors I generated.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

mikey@eukanuba.wpd.sgi.com (Mike Yang) (08/31/90)

In article <1990Aug30.182434.2753@wrl.dec.com>, klee@wsl.dec.com (Ken Lee) writes:
|> A test program I wrote (using DECwindows Ultrix Xlib)
|> correctly caught each of 100 errors I generated.

Gee, you DEC people must write really buggy code...  :-)

-----------------------------------------------------------------------
                 Mike Yang        Silicon Graphics, Inc.
               mikey@sgi.com           415/335-1786