[empathy] contact_list_store_remove_contact: ensure that the store stays alive during the process



commit 683c88254e5488ef7b0d8d0e0fd05f46c41f5914
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Sep 9 12:49:46 2011 +0200

    contact_list_store_remove_contact: ensure that the store stays alive during the process
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658644

 libempathy-gtk/empathy-contact-list-store.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index 189df5d..fb15840 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -1132,6 +1132,11 @@ contact_list_store_remove_contact (EmpathyContactListStore *store,
 		return;
 	}
 
+	/* GtkTreeRowReference owns a ref on the store so removing it from the cache
+	 * may drop our latest reference on the store. Ref it to be sure it stays
+	 * alive during all the process. */
+	g_object_ref (store);
+
 	/* Clean up model */
 	model = GTK_TREE_MODEL (store);
 
@@ -1166,6 +1171,8 @@ contact_list_store_remove_contact (EmpathyContactListStore *store,
 	}
 
 	g_hash_table_remove (priv->empathy_contact_cache, contact);
+
+	g_object_unref (store);
 }
 
 static void



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