diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-04 10:47:27 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-09 14:56:23 +1000 |
commit | b601ea769f1b8a4d7f19e9d4a13541c78e865fe5 (patch) | |
tree | 39fddd6c4f4fc6cc40ff6bf2547c113bc1b76f00 /Xi/ungrdevk.c | |
parent | b0e9e2e32616d09c30a02b9d0ae9db0b13e150d1 (diff) |
dix: allocate temporary grabs on the heap
Once grabs start having nested memory locations, we can't just use the
GrabRec on the stack anymore, we need to alloc/copy/free the grabs.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'Xi/ungrdevk.c')
-rw-r--r-- | Xi/ungrdevk.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index 526347db4..b0d83cbbc 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -98,7 +98,7 @@ ProcXUngrabDeviceKey(ClientPtr client) DeviceIntPtr dev; DeviceIntPtr mdev; WindowPtr pWin; - GrabRec temporaryGrab; + GrabPtr temporaryGrab; int rc; REQUEST(xUngrabDeviceKeyReq); @@ -133,17 +133,22 @@ ProcXUngrabDeviceKey(ClientPtr client) (stuff->modifiers & ~AllModifiersMask)) return BadValue; - temporaryGrab.resource = client->clientAsMask; - temporaryGrab.device = dev; - temporaryGrab.window = pWin; - temporaryGrab.type = DeviceKeyPress; - temporaryGrab.grabtype = GRABTYPE_XI; - temporaryGrab.modifierDevice = mdev; - temporaryGrab.modifiersDetail.exact = stuff->modifiers; - temporaryGrab.modifiersDetail.pMask = NULL; - temporaryGrab.detail.exact = stuff->key; - temporaryGrab.detail.pMask = NULL; - - DeletePassiveGrabFromList(&temporaryGrab); + temporaryGrab = AllocGrab(); + if (!temporaryGrab) + return BadAlloc; + + temporaryGrab->resource = client->clientAsMask; + temporaryGrab->device = dev; + temporaryGrab->window = pWin; + temporaryGrab->type = DeviceKeyPress; + temporaryGrab->grabtype = GRABTYPE_XI; + temporaryGrab->modifierDevice = mdev; + temporaryGrab->modifiersDetail.exact = stuff->modifiers; + temporaryGrab->modifiersDetail.pMask = NULL; + temporaryGrab->detail.exact = stuff->key; + temporaryGrab->detail.pMask = NULL; + + DeletePassiveGrabFromList(temporaryGrab); + FreeGrab(temporaryGrab); return Success; } |