mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-24 11:20:05 +01:00
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 34ec4bd6ac)
This commit is contained in:
parent
ce36ae526d
commit
28d1e21f15
1 changed files with 9 additions and 3 deletions
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue