diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-04-10 08:29:05 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-04-10 08:29:05 +0930 |
commit | 5a4c6621aaf4e886f2c3b633e837ba359fedf921 (patch) | |
tree | e3ad66d30428618203b7adb926c38e48dc7c54f9 | |
parent | 8e0a6529303a52acc10905dd47c72a0d60979676 (diff) |
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.
-rw-r--r-- | Xi/exevents.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index f28952fdc..38f6cb57a 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -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; |