]> git.0d.be Git - empathy.git/commitdiff
Prevent premature finalisation of an EmpathyPersonaStore in certain cases
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 13 Dec 2010 13:55:49 +0000 (13:55 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 13 Dec 2010 13:55:49 +0000 (13:55 +0000)
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

index fbeeb6991ae5c1a2a7fd8536eddf254646588f41..e3c24bab40c6b4a0310a4afa74dedb8219ee291c 100644 (file)
@@ -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