input-settings: Disconnect device signals on dispose

The input settings constructor installs callback functions on device
added/remove and tool-changed.

However, on dispose, those signals are not disconnected, meaning that on
teardown, once the devices get removed eventually, the callback will
still fire and call the callback with freed data, causing a crash.

Make sure we clear the signals on devices on dispose, to avoid the crash
on teardown.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1438
This commit is contained in:
Olivier Fourdan 2020-09-11 12:08:45 +02:00 committed by Georges Basile Stavracas Neto
parent b5749a8b27
commit c956193d09

View File

@ -153,6 +153,8 @@ meta_input_settings_dispose (GObject *object)
MetaInputSettings *settings = META_INPUT_SETTINGS (object); MetaInputSettings *settings = META_INPUT_SETTINGS (object);
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (settings); MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (settings);
g_signal_handlers_disconnect_by_data (priv->seat, settings);
g_clear_object (&priv->virtual_pad_keyboard); g_clear_object (&priv->virtual_pad_keyboard);
g_clear_object (&priv->mouse_settings); g_clear_object (&priv->mouse_settings);