[empathy] Prevent premature finalisation of an EmpathyPersonaStore in certain cases



commit e5677e4dc098d563a5e2617e978c45335717b915
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Dec 13 13:55:49 2010 +0000

    Prevent premature finalisation of an EmpathyPersonaStore in certain cases
    
    In the case that one of the GtkTreeRowReferences belonging to the Personas
    in an EmpathyPersonaStore holds the last reference to the persona store, the
    store can be prematurely finalised, causing Empathy to go into an infinite
    loop inside GHashTable code (the hash table is finalised with the persona
    store, and overwritten with 0xfffâ?¦ â?? this happens to cause the next bit of
    hash table code to be called to go into an infinite loop).
    
    This can be fixed by holding a reference to the persona store when changing
    its personas in response to a personas-changed signal.

 libempathy-gtk/empathy-persona-store.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-persona-store.c b/libempathy-gtk/empathy-persona-store.c
index fbeeb69..e3c24ba 100644
--- a/libempathy-gtk/empathy-persona-store.c
+++ b/libempathy-gtk/empathy-persona-store.c
@@ -532,6 +532,11 @@ individual_personas_changed_cb (GObject *object,
 {
   GList *l;
 
+  /* One of the personas' row references might hold the last reference to the
+   * PersonaStore, so we need to keep a reference ourselves so we don't get
+   * finalised. */
+  g_object_ref (self);
+
   /* Remove the old personas. */
   for (l = removed; l != NULL; l = l->next)
     remove_persona_and_disconnect (self, FOLKS_PERSONA (l->data));
@@ -539,6 +544,8 @@ individual_personas_changed_cb (GObject *object,
   /* Add each of the new personas to the tree model */
   for (l = added; l != NULL; l = l->next)
     add_persona_and_connect (self, FOLKS_PERSONA (l->data));
+
+  g_object_unref (self);
 }
 
 static gint



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