diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-04-30 17:30:32 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-04-30 17:33:07 -0700 |
commit | 28d1e21f1523d475cb757d3cfa33737ed62c534d (patch) | |
tree | f4fe4bc15dab2e8cbdc63f3f331e40151ec44021 | |
parent | ce36ae526d88d20ff67cd6cb429fb06f48d231f6 (diff) |
Dix: Cleaned up sanity checking in Get{Pointer,Keyboard}Events
XQuartz was crashing because the Appkit thread was trying to GetXXXEvents while the Xserver thread was exiting.
This adds some more sanity checks and avoids that crash
(cherry picked from commit 34ec4bd6acb834c0e3f9a5042a0cc3f52c6f3a68)
-rw-r--r-- | dix/getevents.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index bf9331eae..0229c0ac6 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -407,8 +407,8 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type, int num_valuators, int *valuators) { int numEvents = 0; CARD32 ms = 0; - KeySym *map = pDev->key->curKeySyms.map; - KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth]; + KeySym *map; + KeySym sym; deviceKeyButtonPointer *kbp = NULL; if (!events) @@ -419,11 +419,14 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type, return 0; if (!pDev->key || !pDev->focus || !pDev->kbdfeed || - (pDev->coreEvents && !inputInfo.keyboard->key)) + (pDev->coreEvents && !(inputInfo.keyboard && inputInfo.keyboard->key))) return 0; if (key_code < 8 || key_code > 255) return 0; + + map = pDev->key->curKeySyms.map; + sym = map[key_code * pDev->key->curKeySyms.mapWidth]; if (pDev->coreEvents) numEvents = 2; @@ -539,6 +542,9 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, if ((type == ButtonPress || type == ButtonRelease) && !pDev->button) return 0; + + if(pDev->coreEvents && !cp) + return 0; /* FIXME: I guess it should, in theory, be possible to post button events * from devices without valuators. */ |