Debugging protocol errors

Matthew Allen fret at memecode.com
Mon Apr 16 07:07:51 PDT 2007


I'm using x.org's server via Fedora Core 6 and I'm having great difficulty finding and fixing a BadWindow bug in my xlib application. Sorry if this is not the right forum for this enquiry, just let me know if thats the case.

So the problem is that I'm getting a BadWindow reported when calling XPending. I've turned on sync using XSyncronize() and I've installed an protocol error handler. But the error handler never gets called? So assuming that sync is on I run the program in gdb, set a breakpoint on _XError and ran it till it stopped at the breakpoint. The stack trace only mentioned XPending. At this point I have no idea which function call caused the error or even which handle was involved. Which makes it nigh impossible to find the issue.

Most of my xlib calls are in 2 source files, so I instrumented my code with macros before every call and checked that I hadn't use a "Window" handle after destroying it. Which is the only thing I can think of that would cause a "BadWindow" error.

If I knew what the value of the bad window handle was I could compare that to the log of handle usage in my app and find the problem straight away. But it just says the protocol position in the error message.

What else can I try to fix this?
--
Matthew Allen - Memecode Software
(http://www.memecode.com)




More information about the xorg mailing list