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>
This commit is contained in:
parent
48585bd1e3
commit
ecd618957e
11
dix/events.c
11
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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user