[mutter/gnome-3-24] backends: Fix dangling callback not being disconnected



commit e52408d259b8d8318c82ef91a6d32ef5d592ec8f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jul 12 12:24:16 2017 +0200

    backends: Fix dangling callback not being disconnected
    
    This fixes possible crashes if configuration is changed on a device that
    was added and then removed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784881

 src/backends/meta-input-settings.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index cb5bf14..86c3ef6 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -53,6 +53,7 @@ struct _DeviceMappingInfo
   MetaInputSettings *input_settings;
   ClutterInputDevice *device;
   GSettings *settings;
+  guint changed_id;
 #ifdef HAVE_LIBWACOM
   WacomDevice *wacom_device;
 #endif
@@ -1208,6 +1209,7 @@ device_mapping_info_free (DeviceMappingInfo *info)
   if (info->wacom_device)
     libwacom_destroy (info->wacom_device);
 #endif
+  g_signal_handler_disconnect (info->settings, info->changed_id);
   g_object_unref (info->settings);
   g_slice_free (DeviceMappingInfo, info);
 }
@@ -1252,8 +1254,9 @@ check_add_mappable_device (MetaInputSettings  *input_settings,
     }
 #endif
 
-  g_signal_connect (settings, "changed",
-                    G_CALLBACK (mapped_device_changed_cb), info);
+  info->changed_id = g_signal_connect (settings, "changed",
+                                       G_CALLBACK (mapped_device_changed_cb),
+                                       info);
 
   g_hash_table_insert (priv->mappable_devices, device, info);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]