]> git.0d.be Git - empathy.git/commitdiff
roster-view: clear the view when disposing
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 10 Sep 2012 09:14:22 +0000 (11:14 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 11 Sep 2012 08:09:25 +0000 (10:09 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=683699

libempathy-gtk/empathy-roster-view.c

index 8c2c277b62828f2f1ac8eac67c2823359b8dca4d..a5d145943803aa7408ba2eb50389a82308b9b70f 100644 (file)
@@ -1045,6 +1045,17 @@ empathy_roster_view_constructed (GObject *object)
   egg_list_box_set_activate_on_single_click (EGG_LIST_BOX (self), FALSE);
 }
 
+static void
+clear_view (EmpathyRosterView *self)
+{
+  g_hash_table_remove_all (self->priv->roster_contacts);
+  g_hash_table_remove_all (self->priv->roster_groups);
+  g_hash_table_remove_all (self->priv->displayed_contacts);
+
+  gtk_container_foreach (GTK_CONTAINER (self),
+      (GtkCallback) gtk_widget_destroy, NULL);
+}
+
 static void
 empathy_roster_view_dispose (GObject *object)
 {
@@ -1052,6 +1063,10 @@ empathy_roster_view_dispose (GObject *object)
   void (*chain_up) (GObject *) =
       ((GObjectClass *) empathy_roster_view_parent_class)->dispose;
 
+  /* Start by clearing the view so our internal hash tables are cleared from
+   * objects being destroyed. */
+  clear_view (self);
+
   stop_flashing (self);
 
   empathy_roster_view_set_live_search (self, NULL);
@@ -1377,17 +1392,6 @@ empathy_roster_view_show_offline (EmpathyRosterView *self,
   g_object_notify (G_OBJECT (self), "show-offline");
 }
 
-static void
-clear_view (EmpathyRosterView *self)
-{
-  g_hash_table_remove_all (self->priv->roster_contacts);
-  g_hash_table_remove_all (self->priv->roster_groups);
-  g_hash_table_remove_all (self->priv->displayed_contacts);
-
-  gtk_container_foreach (GTK_CONTAINER (self),
-      (GtkCallback) gtk_widget_destroy, NULL);
-}
-
 void
 empathy_roster_view_show_groups (EmpathyRosterView *self,
     gboolean show)