Bug 8582 - two more assertion in xcb_xlib_lock
Summary: two more assertion in xcb_xlib_lock
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: git
Hardware: Other Linux (All)
: highest critical
Assignee: Xorg Project Team
QA Contact:
URL:
Whiteboard:
Keywords:
: 8926 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-10-10 03:59 UTC by Lars Knoll
Modified: 2006-11-11 16:27 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Lars Knoll 2006-10-10 03:59:43 UTC
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);
            }
        }
Comment 1 Jamey Sharp 2006-10-15 17:36:22 UTC
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.
Comment 2 Lars Knoll 2006-10-16 00:36:36 UTC
(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.

Comment 3 Eric Anholt 2006-11-08 12:18:50 UTC
Second half committed.  Thanks!
Comment 4 Jamey Sharp 2006-11-11 16:27:39 UTC
*** 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.