[PATCH] dix: don't copy the wrong event mask when activating a passive grab

Peter Hutterer peter.hutterer at who-t.net
Mon Dec 10 19:52:06 PST 2012


GrabMask is a union of core, XI1 and XI2 masks. If a XI2 grab is activated,
the value is a random pointer value, using it as mask has unpredictable
effects.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/grabs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dix/grabs.c b/dix/grabs.c
index fe79674..3b02352 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -219,7 +219,10 @@ CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
     grab->resource = FakeClientID(client);
     grab->device = device;
     grab->window = window;
-    grab->eventMask = mask->core;       /* same for XI */
+    if (grabtype == CORE || grabtype == XI)
+        grab->eventMask = mask->core;       /* same for XI */
+    else
+        grab->eventMask = 0;
     grab->deviceMask = 0;
     grab->ownerEvents = param->ownerEvents;
     grab->keyboardMode = param->this_device_mode;
-- 
1.8.0.1



More information about the xorg-devel mailing list