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)
This commit is contained in:
parent
ce36ae526d
commit
28d1e21f15
|
@ -407,8 +407,8 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
|
||||||
int num_valuators, int *valuators) {
|
int num_valuators, int *valuators) {
|
||||||
int numEvents = 0;
|
int numEvents = 0;
|
||||||
CARD32 ms = 0;
|
CARD32 ms = 0;
|
||||||
KeySym *map = pDev->key->curKeySyms.map;
|
KeySym *map;
|
||||||
KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth];
|
KeySym sym;
|
||||||
deviceKeyButtonPointer *kbp = NULL;
|
deviceKeyButtonPointer *kbp = NULL;
|
||||||
|
|
||||||
if (!events)
|
if (!events)
|
||||||
|
@ -419,11 +419,14 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
|
if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
|
||||||
(pDev->coreEvents && !inputInfo.keyboard->key))
|
(pDev->coreEvents && !(inputInfo.keyboard && inputInfo.keyboard->key)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (key_code < 8 || key_code > 255)
|
if (key_code < 8 || key_code > 255)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
map = pDev->key->curKeySyms.map;
|
||||||
|
sym = map[key_code * pDev->key->curKeySyms.mapWidth];
|
||||||
|
|
||||||
if (pDev->coreEvents)
|
if (pDev->coreEvents)
|
||||||
numEvents = 2;
|
numEvents = 2;
|
||||||
|
@ -539,6 +542,9 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
|
|
||||||
if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
|
if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if(pDev->coreEvents && !cp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* FIXME: I guess it should, in theory, be possible to post button events
|
/* FIXME: I guess it should, in theory, be possible to post button events
|
||||||
* from devices without valuators. */
|
* from devices without valuators. */
|
||||||
|
|
Loading…
Reference in New Issue