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



commit fcce4dcbe74c9dcf663ac0998d80473099ed6fe2
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 eebf784..8fbeb18 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -2256,12 +2256,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);
+  g_signal_connect_object (priv->client, "device-removed",
+                           G_CALLBACK (gcm_prefs_device_removed_cb), prefs);
+  g_signal_connect_object (priv->client, "changed",
+                           G_CALLBACK (gcm_prefs_changed_cb), prefs);
 
   /* connect to colord */
   cd_client_connect (priv->client,
@@ -2270,12 +2270,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);
+  g_signal_connect_object (priv->client, "sensor-removed",
+                           G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
+                           prefs);
 
   /* 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]