[empathy] Only unref the EmpathyIndividualView after emptying the group hash table



commit 96bf4cf74db1b5c4be55202dcd0e7701ea6cbcd3
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Sep 1 18:38:42 2010 +0100

    Only unref the EmpathyIndividualView after emptying the group hash table
    
    Otherwise, unreffing the view could cause it to be destroyed, and thus
    emptying the hash table will write into freed memory and crash.

 libempathy-gtk/empathy-individual-view.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 05429d0..2f47f84 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -1503,13 +1503,12 @@ individual_view_expand_idle_cb (EmpathyIndividualView *self)
   g_signal_handlers_unblock_by_func (self,
       individual_view_row_expand_or_collapse_cb, GINT_TO_POINTER (TRUE));
 
-  priv->expand_groups_idle_handler = 0;
-  g_object_unref (self);
-
   /* Empty the table of groups to expand/contract, since it may contain groups
    * which no longer exist in the tree view. This can happen after going
    * offline, for example. */
   g_hash_table_remove_all (priv->expand_groups);
+  priv->expand_groups_idle_handler = 0;
+  g_object_unref (self);
 
   return FALSE;
 }



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