Skip to content

gdk/wayland: Clear current_tablet on pad leave

Firefox crashes pretty consistently when unplugging my graphics tablet on gnome desktop (gtk3).
It can be replicated by focusing then un-focusing the browser and unplugging the tablet.
I can less consistently crash the Prompt terminal (gtk4) and even rarely with gnome-terminal.

The crash happens in tablet_pad_handle_removed when trying to run g_list_remove on the pads member of a previously freed tablet.

The problem is that when a tablet is removed in _gdk_wayland_seat_remove_tablet it's pads are cleared out by iterating it's pads list but if the pad has handled a leave event it's not on that list.
The alternative is to iterate through seat->tablet_pads comparing their current_tablet to the tablet being removed.

Introduced in 9f4320a4

Edited by Colin Kinloch

Merge request reports