GNOME Bugzilla – Bug 738520
evdev: Flush event queue before removing device(s)
Last modified: 2014-10-14 17:57:19 UTC
I'm currently hitting a crash on native gnome-shell when switching tty. AFAICS libinput now tries to pair all pressed buttons/keys with a "release" event before the devices disappear, but these events end up queued, and processed after all devices were removed. This causes the crash as the devices have invalid device pointers at the time they are processed. I'm attaching a patch that flushes the event queue before removing a device, just to ensure there's no events pending on it after its removal. This both avoids the crash and ensures actors aren't left in inconsistent states when coming back to that tty.
Created attachment 288505 [details] [review] evdev: Flush event queue before removing an input device libinput_suspend() will trigger the removal of input devices, but also the emission of button/key releases pairing everything that is pressed at that moment. These events are queued, but the ClutterInputDevice pointers in these will point to invalid memory at the time these are processed. Fix this by flushing the event queue, in order to ensure there are no unprocessed input events after libinput_suspend().
Review of attachment 288505 [details] [review]: looks good to me.
Attachment 288505 [details] pushed as 7764fd2 - evdev: Flush event queue before removing an input device