Xlib error handler causes xcb double lock

Michael Riepe michael.riepe at googlemail.com
Sat Mar 15 04:50:30 PDT 2008


Hi!

I'm using mwm, and it keeps crashing on me with a failed locking
assertion ("!c->xlib.lock") from libxcb (unless I allow sloppy locking).
After investigating the issue, I came to the conclusion that it's an
Xlib issue:

- mwm uses its own error handler (set with XSetErrorHandler) in order to
catch BadWindow errors, e.g. from XGetWindowAttributes.

- the error handler calls XFindContext which in turn calls LockDisplay
(and _XCBLockDisplay, and xcb_xlib_lock) on the already locked display.

- similarly, when the error handler returns, xcb_xlib_unlock is called a
second time.

Note that calling XFindContext (or any other function belonging to the
context manager) from an error handler was always assumed to be legal
because the functions don't issue any protocol requests. And although
they may have to lock the Display structure (or, at least, the context
store itself) to avoid database corruption, it's wrong for them to call
xcb_xlib_{lock,unlock}, in my opinion.

My setup (just for the record - I doubt it matters):
Linux (2.6.x kernel), Xorg 7.3 (libX11 1.1.3), libxcb 1.1.

-- 
Michael "Tired" Riepe <michael.riepe at googlemail.com>
X-Tired: Each morning I get up I die a little




More information about the xorg mailing list