Xi: some extra checks for validity of kbd and mouse.
Floating SDs are paired with themselves, so the paired device may not be a proper keyboard or mouse. Put some extra checks in to avoid dereferencing a nullpointer later.
This commit is contained in:
parent
8e0a652930
commit
5a4c6621aa
@ -730,11 +730,15 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
|
||||
{
|
||||
kbd = GetPairedDevice(device);
|
||||
mouse = device;
|
||||
if (!kbd->key) /* can happen with floating SDs */
|
||||
kbd = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse = GetPairedDevice(device);
|
||||
kbd = device;
|
||||
if (!mouse->valuator || !mouse->button) /* may be float. SDs */
|
||||
mouse = NULL;
|
||||
}
|
||||
xE->u.keyButtonPointer.state = (kbd) ? (kbd->key->state) : 0;
|
||||
xE->u.keyButtonPointer.state |= (mouse) ? (mouse->button->state) : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user