[gnome-control-center] datetime: Disconnect from GtkStack signals before widget destruction



commit 7ae60ad2cf8a1346f16e55ad5c733b1c0becaa0b
Author: Kalev Lember <kalevlember gmail com>
Date:   Fri Oct 4 18:14:46 2013 +0200

    datetime: Disconnect from GtkStack signals before widget destruction
    
    This fixes a regression from commit 545c886 that caused criticals when
    leaving the datetime panel.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709443

 panels/datetime/cc-datetime-panel.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 0a2b11c..3392ae2 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -90,6 +90,7 @@ struct _CcDateTimePanelPrivate
   GtkWidget *am_label;
   GtkWidget *pm_label;
   GtkWidget *am_pm_stack;
+  gulong am_pm_visiblity_changed_id;
 
   GnomeWallClock *clock_tracker;
 
@@ -140,6 +141,13 @@ cc_date_time_panel_dispose (GObject *object)
       g_clear_object (&priv->cancellable);
     }
 
+  if (priv->am_pm_visiblity_changed_id != 0)
+    {
+      g_signal_handler_disconnect (priv->am_pm_stack,
+                                   priv->am_pm_visiblity_changed_id);
+      priv->am_pm_visiblity_changed_id = 0;
+    }
+
   g_clear_object (&priv->builder);
   g_clear_object (&priv->clock_tracker);
   g_clear_object (&priv->dtm);
@@ -1132,8 +1140,10 @@ setup_am_pm_button (CcDateTimePanel *self)
   gtk_container_add (GTK_CONTAINER (priv->am_pm_stack), priv->am_label);
   gtk_container_add (GTK_CONTAINER (priv->am_pm_stack), priv->pm_label);
   gtk_widget_show_all (priv->am_pm_stack);
-  g_signal_connect_swapped (priv->am_pm_stack, "notify::visible-child",
-                            G_CALLBACK (am_pm_stack_visible_child_changed_cb), self);
+  priv->am_pm_visiblity_changed_id = g_signal_connect_swapped (priv->am_pm_stack,
+                                                               "notify::visible-child",
+                                                               G_CALLBACK 
(am_pm_stack_visible_child_changed_cb),
+                                                               self);
   am_pm_stack_visible_child_changed_cb (self);
 
   am_pm_button = W ("am_pm_button");


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