From bf37ce8edc252beb4aa2c6b942c86672f5bb2815 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 6 Mar 2025 09:40:22 +1000 Subject: [PATCH] Xi: disallow grabbing disabled devices Grabbing a disabled (pointer) device will lead to a segfault later in the myriad of places where we look at the device's spriteInfo - which will be NULL. As a workaround, disallow grabbing a disabled device by pretending it's already grabbed. Since the point of a grab is to receive all events by that device and disabled devices cannot send events, this should be Good Enough. Tested-by: Olivier Fourdan (cherry picked from commit 797f63b8be1693a7c0ae5df8b76911d804959ce5) Part-of: --- Xi/xigrabdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c index cf3ee7b95..40e2e5817 100644 --- a/Xi/xigrabdev.c +++ b/Xi/xigrabdev.c @@ -82,6 +82,9 @@ ProcXIGrabDevice(ClientPtr client) if (ret != Success) return ret; + if (!dev->enabled) + return AlreadyGrabbed; + if (!IsMaster(dev)) stuff->paired_device_mode = GrabModeAsync;