diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-22 15:19:34 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-22 15:27:16 +1000 |
commit | ecd618957ebf01cb4137f98efec3faed35f8a9f5 (patch) | |
tree | 0ceba88b7af31b6afbf3dc6b47f3863ba48a246b /dix/events.c | |
parent | 48585bd1e3e98db0f3df1ecc68022510216e00cc (diff) |
dix: fix null-pointer dereference on activating enter/focus grabs.
EventToXI2 returns a NULL event for enter/focus events since these events
aren't yet wrapped into internal events. This is a quickfix only, it works
thanks to the alignment of internal and XI2 event types.
Eventually, enter/leave events should be wrapped into internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/events.c')
-rw-r--r-- | dix/events.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/dix/events.c b/dix/events.c index 750546315..f50229a91 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3474,7 +3474,16 @@ CheckPassiveGrabsOnWindow( continue; } count = 1; - mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8]; + + /* FIXME: EventToXI2 returns NULL for enter events, so + * dereferencing the event is bad. Internal event types are + * aligned with core events, so the else clause is valid. + * long-term we should use internal events for enter/focus + * as well */ + if (xE) + mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8]; + else if (event->type == XI_Enter || event->type == XI_FocusIn) + mask = grab->xi2mask[device->id][event->type/8]; } else { rc = EventToXI((InternalEvent*)event, &xE, &count); |