The first happens when trying to initialize XFixes, the second one when starting up emacs. I'm rather sure the first patch is correct (as I don't think you need a lock for reads from the display structure), but I'm unsure about the second one (but I don't think the display should be locked for the callback). Anyway, this makes me wonder how many other locking bugs there are... Cheers, Lars diff --git a/src/Xfixes.c b/src/Xfixes.c index 5b279a1..cf56b5a 100644 --- a/src/Xfixes.c +++ b/src/Xfixes.c @@ -322,8 +322,6 @@ XFixesQueryVersion (Display *dpy, *major_versionp = info->major_version; *minor_versionp = info->minor_version; - UnlockDisplay (dpy); - SyncHandle (); return 1; } diff --git a/src/FilterEv.c b/src/FilterEv.c index 0117291..9fa1887 100644 --- a/src/FilterEv.c +++ b/src/FilterEv.c @@ -96,9 +96,9 @@ #if XLOCALE if (win == p->window) { if ((mask & p->event_mask) || (ev->type >= p->start_type && ev->type <= p->end_type)) { + UnlockDisplay(ev->xany.display); ret = (*(p->filter))(ev->xany.display, p->window, ev, p->client_data); - UnlockDisplay(ev->xany.display); return(ret); } }
There are many locking bugs in the Xlib... :-) The XFixes change was obviously correct, so I pushed it. I haven't found any documentation on whether event filter callbacks are supposed to have the Display lock or not, so I can't tell if the libX11 change is correct. At the moment I'm not sure how to proceed with that.
(In reply to comment #1) > There are many locking bugs in the Xlib... :-) > > The XFixes change was obviously correct, so I pushed it. > > I haven't found any documentation on whether event filter callbacks are supposed > to have the Display lock or not, so I can't tell if the libX11 change is > correct. At the moment I'm not sure how to proceed with that. The callback goes back into application space. From there you could in theory call almost any Xlib function. This is IMO a strong argument for unlocking before the callback.
Second half committed. Thanks!
*** Bug 8926 has been marked as a duplicate of this bug. ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.