After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 738520 - evdev: Flush event queue before removing device(s)
evdev: Flush event queue before removing device(s)
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
1.20.x
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2014-10-14 11:42 UTC by Carlos Garnacho
Modified: 2014-10-14 17:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
evdev: Flush event queue before removing an input device (1.82 KB, patch)
2014-10-14 11:43 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2014-10-14 11:42:31 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.
Comment 1 Carlos Garnacho 2014-10-14 11:43:23 UTC
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().
Comment 2 Emmanuele Bassi (:ebassi) 2014-10-14 11:46:25 UTC
Review of attachment 288505 [details] [review]:

looks good to me.
Comment 3 Carlos Garnacho 2014-10-14 17:57:16 UTC
Attachment 288505 [details] pushed as 7764fd2 - evdev: Flush event queue before removing an input device