[PATCH libXi 2/2] XIPassiveGrab: Fix completely broken locking in XIGrabTouchBegin

Jasper St. Pierre jstpierre at mecheye.net
Tue Jul 8 14:01:04 PDT 2014


_XIPassiveGrabDevice calls LockDisplay as the first thing it does. That
means that it expects the display to be unlocked. XIGrabTouchBegin locks
the display to check for the XI extension, and then never unlocks it.
Effectively, this meant that anybody that called XIGrabTouchBegin after
XInitThreads just got a deadlock.

Cool.
---
 src/XIPassiveGrab.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c
index f3a9924..88f1aff 100644
--- a/src/XIPassiveGrab.c
+++ b/src/XIPassiveGrab.c
@@ -166,6 +166,7 @@ XIGrabTouchBegin(Display *dpy, int deviceid, Window grab_window,
     LockDisplay(dpy);
     if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1)
 	return -1;
+    UnlockDisplay(dpy);
 
     /* FIXME: allow selection of GrabMode for paired devices? */
     return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeTouchBegin, 0,
-- 
2.0.0



More information about the xorg-devel mailing list