[gnome-control-center/gnome-3-6] color: disconnect signals when the panel goes away



commit d926b3de6b9925bfa7736b7c969db07bce4b3039
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 23 00:19:44 2013 -0500

    color: disconnect signals when the panel goes away
    
    The CdClient object is a singleton, thus it could conceivable
    survive the panel, even though we drop our reference in dispose.
    In that case, the signal handlers have stale user_data, and
    bad things might happen when they trigger.
    
    This patch is a guess at the cause for the stacktrace in
    https://bugzilla.redhat.com/show_bug.cgi?id=893914
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692354

 panels/color/cc-color-panel.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index de82dca..6cc96bd 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -2538,12 +2538,12 @@ cc_color_panel_init (CcColorPanel *prefs)
 
   /* use a device client array */
   priv->client = cd_client_new ();
-  g_signal_connect (priv->client, "device-added",
-                    G_CALLBACK (gcm_prefs_device_added_cb), prefs);
-  g_signal_connect (priv->client, "device-removed",
-                    G_CALLBACK (gcm_prefs_device_removed_cb), prefs);
-  g_signal_connect (priv->client, "changed",
-                    G_CALLBACK (gcm_prefs_changed_cb), prefs);
+  g_signal_connect_object (priv->client, "device-added",
+                           G_CALLBACK (gcm_prefs_device_added_cb), prefs, 0);
+  g_signal_connect_object (priv->client, "device-removed",
+                           G_CALLBACK (gcm_prefs_device_removed_cb), prefs, 0);
+  g_signal_connect_object (priv->client, "changed",
+                           G_CALLBACK (gcm_prefs_changed_cb), prefs, 0);
 
   /* connect to colord */
   cd_client_connect (priv->client,
@@ -2552,12 +2552,12 @@ cc_color_panel_init (CcColorPanel *prefs)
                      prefs);
 
   /* use the color sensor */
-  g_signal_connect (priv->client, "sensor-added",
-                    G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
-                    prefs);
-  g_signal_connect (priv->client, "sensor-removed",
-                    G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
-                    prefs);
+  g_signal_connect_object (priv->client, "sensor-added",
+                           G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
+                           prefs, 0);
+  g_signal_connect_object (priv->client, "sensor-removed",
+                           G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
+                           prefs, 0);
 
   /* set calibrate button sensitivity */
   gcm_prefs_set_calibrate_button_sensitivity (prefs);



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