|
From: Daniel J S. <dan...@ie...> - 2006-04-10 17:15:52
|
Dave Denholm wrote: > Beware that the x protocol (and so xlib) is mostly > asynchronous. Errors are usually sent asynchronously, like events. > > It is possible to handle errors, just a little messy. I forget the > details, but you can use XSync() to force a round-trip to the > server. This way, you can guarantee that all errors have been > delivered for requests up to the sync. > > man XSync > ... > The XSync function flushes the output buffer and then waits > until all requests have been received and processed by the X > server. Any errors generated must be handled by the error > handler. For each protocol error received by Xlib, XSync > calls the client application's error handling routine (see > section 11.8.2). Any events generated by the server are > enqueued into the library's event queue. > > > There there is some way in xlib to attach a hook for errors. You can > check to see if it is an error you expected, and you can tolerate. > > ah - yes - see XSetErrorHandler I'm somewhat familiar with XSetErrorHandler. We needed that to deal with asynchronous error events to properly remove plots form the linked list. (E.g., clicking on the window border's "X" close button issues an asynchronous error that gets filtered back to the client, who may be doing something to that display at the time. This was a bit of a problem in which closing the X window with a mouse click in the "x" box would often cause a seg fault. That is working well now.) Not sure this is directly related to the problem though. Could be. Dan |