Re: [PATCH] Fix locking bugs with XIAllowTouchEvents() and XIUngrabTouchBegin()

2014-07-13 Thread Peter Hutterer
On Fri, Jul 11, 2014 at 03:13:54PM -0400, otay...@redhat.com wrote:
 From: Owen W. Taylor otay...@fishsoup.net
 
 Fix two places where the display was double locked when an API
 function chained to an implementation that also locks the display.
 ---
  src/XIAllowEvents.c | 7 +--
  src/XIPassiveGrab.c | 1 +
  2 files changed, 2 insertions(+), 6 deletions(-)
 
 diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
 index c8d997a..2468fce 100644
 --- a/src/XIAllowEvents.c
 +++ b/src/XIAllowEvents.c
 @@ -86,17 +86,12 @@ Status
  XIAllowTouchEvents(Display *dpy, int deviceid, unsigned int touchid,
 Window grab_window, int event_mode)
  {
 -int status;
  XExtDisplayInfo *extinfo = XInput_find_display(dpy);
  
  LockDisplay(dpy);
  if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1)
   return (NoSuchExtension);
 -
 -status = _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid, 
 grab_window);
 -
  UnlockDisplay(dpy);
 -SyncHandle();
  
 -return status;
 +return _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid, 
 grab_window);
  }
 diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c
 index 88f1aff..c743516 100644
 --- a/src/XIPassiveGrab.c
 +++ b/src/XIPassiveGrab.c
 @@ -249,6 +249,7 @@ XIUngrabTouchBegin(Display* display, int deviceid, Window 
 grab_window,
  LockDisplay(display);
  if (_XiCheckExtInit(display, XInput_2_2, extinfo) == -1)
   return -1;
 +UnlockDisplay(display);
  
  return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeTouchBegin, 0,
grab_window, num_modifiers, modifiers);
 -- 
 1.9.3

pushed, thanks!
   0250f40..b731d13  master - master

I'll give it a few days to see if you find another one like this and then
push out the 1.7.4 update.

Cheers,
   Peter
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH] Fix locking bugs with XIAllowTouchEvents() and XIUngrabTouchBegin()

2014-07-11 Thread otaylor
From: Owen W. Taylor otay...@fishsoup.net

Fix two places where the display was double locked when an API
function chained to an implementation that also locks the display.
---
 src/XIAllowEvents.c | 6 +-
 src/XIPassiveGrab.c | 1 +
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
index c8d997a..b0be6bb 100644
--- a/src/XIAllowEvents.c
+++ b/src/XIAllowEvents.c
@@ -92,11 +92,7 @@ XIAllowTouchEvents(Display *dpy, int deviceid, unsigned int 
touchid,
 LockDisplay(dpy);
 if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1)
return (NoSuchExtension);
-
-status = _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid, 
grab_window);
-
 UnlockDisplay(dpy);
-SyncHandle();
 
-return status;
+return _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid, 
grab_window);
 }
diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c
index 88f1aff..c743516 100644
--- a/src/XIPassiveGrab.c
+++ b/src/XIPassiveGrab.c
@@ -249,6 +249,7 @@ XIUngrabTouchBegin(Display* display, int deviceid, Window 
grab_window,
 LockDisplay(display);
 if (_XiCheckExtInit(display, XInput_2_2, extinfo) == -1)
return -1;
+UnlockDisplay(display);
 
 return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeTouchBegin, 0,
   grab_window, num_modifiers, modifiers);
-- 
1.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] Fix locking bugs with XIAllowTouchEvents() and XIUngrabTouchBegin()

2014-07-11 Thread Jasper St. Pierre
On Fri, Jul 11, 2014 at 1:54 PM, otay...@redhat.com wrote:

 From: Owen W. Taylor otay...@fishsoup.net

 Fix two places where the display was double locked when an API
 function chained to an implementation that also locks the display.
 ---
  src/XIAllowEvents.c | 6 +-
  src/XIPassiveGrab.c | 1 +
  2 files changed, 2 insertions(+), 5 deletions(-)

 diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
 index c8d997a..b0be6bb 100644
 --- a/src/XIAllowEvents.c
 +++ b/src/XIAllowEvents.c
 @@ -92,11 +92,7 @@ XIAllowTouchEvents(Display *dpy, int deviceid, unsigned
 int touchid,
  LockDisplay(dpy);
  if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1)
 return (NoSuchExtension);
 -
 -status = _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime,
 touchid, grab_window);
 -
  UnlockDisplay(dpy);
 -SyncHandle();

 -return status;
 +return _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime,
 touchid, grab_window);


Shouldn't you remove the declaration for status here?


  }
 diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c
 index 88f1aff..c743516 100644
 --- a/src/XIPassiveGrab.c
 +++ b/src/XIPassiveGrab.c
 @@ -249,6 +249,7 @@ XIUngrabTouchBegin(Display* display, int deviceid,
 Window grab_window,
  LockDisplay(display);
  if (_XiCheckExtInit(display, XInput_2_2, extinfo) == -1)
 return -1;
 +UnlockDisplay(display);

  return _XIPassiveUngrabDevice(display, deviceid,
 XIGrabtypeTouchBegin, 0,
grab_window, num_modifiers, modifiers);
 --
 1.9.3

 ___
 xorg-devel@lists.x.org: X.Org development
 Archives: http://lists.x.org/archives/xorg-devel
 Info: http://lists.x.org/mailman/listinfo/xorg-devel




-- 
  Jasper
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH] Fix locking bugs with XIAllowTouchEvents() and XIUngrabTouchBegin()

2014-07-11 Thread otaylor
From: Owen W. Taylor otay...@fishsoup.net

Fix two places where the display was double locked when an API
function chained to an implementation that also locks the display.
---
 src/XIAllowEvents.c | 7 +--
 src/XIPassiveGrab.c | 1 +
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
index c8d997a..2468fce 100644
--- a/src/XIAllowEvents.c
+++ b/src/XIAllowEvents.c
@@ -86,17 +86,12 @@ Status
 XIAllowTouchEvents(Display *dpy, int deviceid, unsigned int touchid,
Window grab_window, int event_mode)
 {
-int status;
 XExtDisplayInfo *extinfo = XInput_find_display(dpy);
 
 LockDisplay(dpy);
 if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1)
return (NoSuchExtension);
-
-status = _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid, 
grab_window);
-
 UnlockDisplay(dpy);
-SyncHandle();
 
-return status;
+return _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid, 
grab_window);
 }
diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c
index 88f1aff..c743516 100644
--- a/src/XIPassiveGrab.c
+++ b/src/XIPassiveGrab.c
@@ -249,6 +249,7 @@ XIUngrabTouchBegin(Display* display, int deviceid, Window 
grab_window,
 LockDisplay(display);
 if (_XiCheckExtInit(display, XInput_2_2, extinfo) == -1)
return -1;
+UnlockDisplay(display);
 
 return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeTouchBegin, 0,
   grab_window, num_modifiers, modifiers);
-- 
1.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] Fix locking bugs with XIAllowTouchEvents() and XIUngrabTouchBegin()

2014-07-11 Thread Owen Taylor
Jasper St. Pierre wrote:
 int touchid,
 LockDisplay(dpy);
 if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1)
 return (NoSuchExtension);
 -
 - status = _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid,
 grab_window);
 -
 UnlockDisplay(dpy);
 - SyncHandle();
 
 - return status;
 + return _XIAllowEvents(dpy, deviceid, event_mode, CurrentTime, touchid,
 grab_window);
 
 Shouldn't you remove the declaration for status here?

Yes, thanks - new version sent.

- Owen
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel