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 <ofourdan@redhat.com>
(cherry picked from commit 797f63b8be)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
This commit is contained in:
Peter Hutterer 2025-03-06 09:40:22 +10:00 committed by Olivier Fourdan
parent 91e42e523c
commit 3a6d035aec

View file

@ -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;