diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-12-13 13:55:49 +0000 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-12-13 13:55:49 +0000 |
commit | e5677e4dc098d563a5e2617e978c45335717b915 (patch) | |
tree | 8ec938ff88da0705ef18e450f21f388c02b5d20b | |
parent | 315675364ae3c5afb3bda08a7389d655112ad7a5 (diff) |
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.
-rw-r--r-- | 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 fbeeb6991..e3c24bab4 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 |