Mutter crashes in clutter_input_device_get_device_type during device removal
Coming from !823 (comment 866367)
gnome-shell can crash with the trace below when quickly attaching/detaching input devices:
(gnome-shell:3876543): Gjs-CRITICAL **: 01:03:55.313: Object .MetaInputDeviceX11 (0x555558793460), has been already deallocated — impossible to get any property from it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x5555555f92a0 ==
#0 7fffffffb7b0 b /media/M2/GNOME/gnome-shell/js/ui/keyboard.js:1140 (e7b64fdb880 @ 3)
Thread 1 "gnome-shell" received signal SIGSEGV, Segmentation fault.
--Type <RET> for more, q to quit, c to continue without paging--
0x00007ffff70526e5 in clutter_input_device_get_device_type (device=0x555558793740)
at ../../mutter/clutter/clutter/clutter-input-device.c:886
886 g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
(gdb) bt
#0 0x00007ffff70526e5 in clutter_input_device_get_device_type (device=0x555558793740)
at ../../mutter/clutter/clutter/clutter-input-device.c:886
#1 0x00007ffff6e08c86 in update_last_device (backend=0x555555586170)
at ../../mutter/src/backends/meta-backend.c:1264
#2 0x00007ffff7a2b24e in g_main_dispatch (context=0x555555583080)
at ../../glib/glib/gmain.c:3309
#3 g_main_context_dispatch (context=context@entry=0x555555583080)
at ../../glib/glib/gmain.c:3974
#4 0x00007ffff7a2b5f0 in g_main_context_iterate (context=0x555555583080,
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
at ../../glib/glib/gmain.c:4047
#5 0x00007ffff7a2bad3 in g_main_loop_run (loop=0x55555596dc00)
at ../../glib/glib/gmain.c:4241
#6 0x00007ffff6e67270 in meta_run () at ../../mutter/src/core/main.c:663
#7 0x00005555555572f4 in main (argc=1, argv=0x7fffffffc9d8)
at ../../gnome-shell/src/main.c:550
To replicate under X11, follow these instructions.
/cc @SyntevoAlex
Edited by Marco Trevisan