From 08779c62ba2f4cbfa47e3cf738daf8abd74b60cf Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 27 Jun 2007 11:16:55 +0930 Subject: [PATCH] Reset grab->next to NULL when we're creating a grab. This is definitely necessary in CheckDeviceGrabAndHintWindow (thanks to Paulo Zanoni for spotting it). We're resetting it everywhere else too, just to be save. --- Xi/exevents.c | 1 + dix/events.c | 7 +++++++ dix/grabs.c | 1 + 3 files changed, 9 insertions(+) diff --git a/Xi/exevents.c b/Xi/exevents.c index 719e9db0d..c13b74705 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1170,6 +1170,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, tempGrab.confineTo = NullWindow; tempGrab.cursor = NullCursor; tempGrab.genericMasks = NULL; + tempGrab.next = NULL; (*dev->deviceGrab.ActivateGrab) (dev, &tempGrab, currentTime, TRUE); } } diff --git a/dix/events.c b/dix/events.c index 51bd2d8d2..77d62754f 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2001,6 +2001,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent GrabRec tempGrab; OtherInputMasks *inputMasks; + tempGrab.next = NULL; tempGrab.device = pDev; tempGrab.resource = client->clientAsMask; tempGrab.window = pWin; @@ -3023,6 +3024,7 @@ CheckPassiveGrabsOnWindow( tempGrab.detail.exact = xE->u.u.detail; tempGrab.detail.pMask = NULL; tempGrab.modifiersDetail.pMask = NULL; + tempGrab.next = NULL; for (; grab; grab = grab->next) { #ifdef XKB @@ -4652,6 +4654,7 @@ ProcGrabPointer(ClientPtr client) ConfineCursorToWindow(device, RootWindow(device), FALSE, FALSE); oldCursor = grab->cursor; } + tempGrab.next = NULL; tempGrab.cursor = cursor; tempGrab.resource = client->clientAsMask; tempGrab.ownerEvents = stuff->ownerEvents; @@ -4820,6 +4823,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, /* Otherwise segfaults happen on grabbed MPX devices */ memset(&tempGrab, 0, sizeof(GrabRec)); + tempGrab.next = NULL; tempGrab.window = pWin; tempGrab.resource = client->clientAsMask; tempGrab.ownerEvents = ownerEvents; @@ -5192,6 +5196,7 @@ ProcUngrabKey(ClientPtr client) tempGrab.type = KeyPress; tempGrab.detail.exact = stuff->key; tempGrab.detail.pMask = NULL; + tempGrab.next = NULL; if (!DeletePassiveGrabFromList(&tempGrab)) return(BadAlloc); @@ -5370,6 +5375,7 @@ ProcUngrabButton(ClientPtr client) tempGrab.type = ButtonPress; tempGrab.detail.exact = stuff->button; tempGrab.detail.pMask = NULL; + tempGrab.next = NULL; if (!DeletePassiveGrabFromList(&tempGrab)) return(BadAlloc); @@ -5897,6 +5903,7 @@ ExtGrabDevice(ClientPtr client, newGrab.confineTo = confineTo; newGrab.eventMask = xi_mask; newGrab.genericMasks = NULL; + newGrab.next = NULL; if (ge_masks) { diff --git a/dix/grabs.c b/dix/grabs.c index e1dd6c546..af471ebb3 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -106,6 +106,7 @@ CreateGrab( grab->confineTo = confineTo; grab->cursor = cursor; grab->genericMasks = NULL; + grab->next = NULL; if (cursor) cursor->refcnt++; return grab;