From 23365d28651f7942fdafb889bcbbd019470a4274 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 12 Nov 2007 13:08:38 +1030 Subject: dix: allow grab modifier device to be NULL. This can happen if we check for a passive core grab and our device is a floating slave device. Doesn't really change anything as SDs can't send core events but it stops the server from segfaulting. --- dix/events.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'dix') diff --git a/dix/events.c b/dix/events.c index c3589f0c8..daebe3588 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3379,7 +3379,7 @@ CheckPassiveGrabsOnWindow( { #ifdef XKB DeviceIntPtr gdev; - XkbSrvInfoPtr xkbi; + XkbSrvInfoPtr xkbi = NULL; gdev= grab->modifierDevice; if (grab->coreGrab) @@ -3389,7 +3389,8 @@ CheckPassiveGrabsOnWindow( else gdev = device; } - xkbi= gdev->key->xkbInfo; + if (gdev) + xkbi= gdev->key->xkbInfo; #endif tempGrab.modifierDevice = grab->modifierDevice; if ((device == grab->modifierDevice) && @@ -3400,16 +3401,20 @@ CheckPassiveGrabsOnWindow( )) tempGrab.modifiersDetail.exact = #ifdef XKB - (noXkbExtension?gdev->key->prev_state:xkbi->state.grab_mods); + (noXkbExtension) ? + ((gdev) ? gdev->key->prev_state : 0) : + ((xkbi) ? xkbi->state.grab_mods : 0); #else - grab->modifierDevice->key->prev_state; + (gdev) ? gdev->key->prev_state : 0; #endif else tempGrab.modifiersDetail.exact = #ifdef XKB - (noXkbExtension ? gdev->key->state : xkbi->state.grab_mods); + (noXkbExtension) ? + ((gdev) ? gdev->key->state : 0) : + ((xkbi) ? xkbi->state.grab_mods : 0); #else - grab->modifierDevice->key->state; + (gdev) ? gdev->key->state : 0; #endif /* ignore the device for core events when comparing grabs */ if (GrabMatchesSecond(&tempGrab, grab, (xE->u.u.type < LASTEvent)) && -- cgit v1.2.3