[gnome-control-center] color: Prevent a crash when hotplugging monitors when the color panel is open



commit c31f2eed794ed2be4c17ca7c1c85eb41eebe930d
Author: Richard Hughes <richard hughsie com>
Date:   Fri Mar 16 12:45:13 2012 +0000

    color: Prevent a crash when hotplugging monitors when the color panel is open

 panels/color/cc-color-panel.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index fce15ca..1b446c0 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -1856,6 +1856,7 @@ gcm_prefs_remove_device (CcColorPanel *prefs, CdDevice *cd_device)
   const gchar *id;
   gchar *id_tmp;
   gboolean ret;
+  CdDevice *device_tmp;
   CcColorPanelPrivate *priv = prefs->priv;
 
   /* remove */
@@ -1875,8 +1876,15 @@ gcm_prefs_remove_device (CcColorPanel *prefs, CdDevice *cd_device)
                           -1);
       if (g_strcmp0 (id_tmp, id) == 0)
         {
+          gtk_tree_model_get (model, &iter,
+                              GCM_PREFS_COLUMN_DEVICE, &device_tmp,
+                              -1);
+          g_signal_handlers_disconnect_by_func (device_tmp,
+                                                G_CALLBACK (gcm_prefs_device_changed_cb),
+                                                prefs);
           gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
           g_free (id_tmp);
+          g_object_unref (device_tmp);
           break;
         }
       g_free (id_tmp);



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