[empathy] Remove the expand groups idle handler when destroying an EmpathyIndividualView



commit 416fc11e36c34a4c7ea489a25904ac9c6df4bd78
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Sep 1 14:32:08 2010 +0100

    Remove the expand groups idle handler when destroying an EmpathyIndividualView
    
    This prevents the idle handler from being run after destruction and crashing
    due to referencing the EmpathyIndividualView's private memory which has
    already been freed.

 libempathy-gtk/empathy-individual-view.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 34032d6..05429d0 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -1503,8 +1503,8 @@ 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));
 
-  g_object_unref (self);
   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
@@ -1927,6 +1927,8 @@ individual_view_finalize (GObject *object)
 {
   EmpathyIndividualViewPriv *priv = GET_PRIV (object);
 
+  if (priv->expand_groups_idle_handler != 0)
+    g_source_remove (priv->expand_groups_idle_handler);
   g_hash_table_destroy (priv->expand_groups);
 
   G_OBJECT_CLASS (empathy_individual_view_parent_class)->finalize (object);



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