changeset 27480:cbee8aecc90a

Free the buddy list data some more at shutdown and some deprecations. I think these deprecations are reasonable. Basically, purple_blist_init should create a PurpleBuddyList*, so each UI doesn't need to do that. The UI data for the PurpleBuddyList is more tightly coupled with the PurpleBuddyList and purple_blist_destroy is called in purple_blist_uninit (and is fully cleaned up now). As libpurple works currently, I believe it's not really possible to have multiple PurpleBuddyLists around (blist.c relies on a single global variable) and when it was discussed on the mailing list a few months ago, nobody was using it as such. Refs #9253 (going to milestone 3.0.0 it).
author Paul Aurich <paul@darkrain42.org>
date Sun, 12 Jul 2009 02:55:36 +0000
parents 5345dfe48272
children 3bb1085235d0
files ChangeLog.API libpurple/blist.c libpurple/blist.h pidgin/gtkblist.c
diffstat 4 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sat Jul 11 21:53:52 2009 +0000
+++ b/ChangeLog.API	Sun Jul 12 02:55:36 2009 +0000
@@ -82,9 +82,12 @@
 
 		Deprecated:
 		* buddy-added and buddy-removed blist signals
+		* purple_blist_destroy
+		* purple_blist_new
 		* purple_buddy_get_local_alias
+		* purple_ip_address_is_valid
 		* purple_notify_user_info_remove_entry
-		* purple_ip_address_is_valid
+		* purple_set_blist
 		* purple_status_type_set_primary_attr
 		* purple_status_type_add_attr
 		* purple_status_type_add_attrs
--- a/libpurple/blist.c	Sat Jul 11 21:53:52 2009 +0000
+++ b/libpurple/blist.c	Sun Jul 12 02:55:36 2009 +0000
@@ -3105,6 +3105,8 @@
 		purple_blist_sync();
 	}
 
+	purple_blist_destroy();
+
 	node = purple_blist_get_root();
 	while (node) {
 		next_node = node->next;
@@ -3112,10 +3114,14 @@
 		node = next_node;
 	}
 	purplebuddylist->root = NULL;
-	
+
 	g_hash_table_destroy(purplebuddylist->buddies);
 	g_hash_table_destroy(buddies_cache);
 
+	PURPLE_DBUS_UNREGISTER_POINTER(purplebuddylist);
+	g_free(purplebuddylist);
+	purplebuddylist = NULL;
+
 	purple_signals_disconnect_by_handle(purple_blist_get_handle());
 	purple_signals_unregister_by_instance(purple_blist_get_handle());
 }
--- a/libpurple/blist.h	Sat Jul 11 21:53:52 2009 +0000
+++ b/libpurple/blist.h	Sun Jul 12 02:55:36 2009 +0000
@@ -235,6 +235,7 @@
  * Creates a new buddy list
  *
  * @return The new buddy list.
+ * @deprecated In 3.0.0, this will be handled by purple_blist_init()
  */
 PurpleBuddyList *purple_blist_new(void);
 
@@ -242,6 +243,7 @@
  * Sets the main buddy list.
  *
  * @param blist The buddy list you want to use.
+ * @deprecated In 3.0.0, this will be handled by purple_blist_init()
  */
 void purple_set_blist(PurpleBuddyList *blist);
 
@@ -383,6 +385,10 @@
 
 /**
  * Destroys the buddy list window.
+ *
+ * @deprecated The UI is responsible for cleaning up the
+ *             PurpleBuddyList->ui_data. purple_blist_uninit() will free the
+ *             PurpleBuddyList* itself.
  */
 void purple_blist_destroy(void);
 
--- a/pidgin/gtkblist.c	Sat Jul 11 21:53:52 2009 +0000
+++ b/pidgin/gtkblist.c	Sun Jul 12 02:55:36 2009 +0000
@@ -6714,14 +6714,15 @@
 #endif
 }
 
-
 static void pidgin_blist_destroy(PurpleBuddyList *list)
 {
 	PidginBuddyListPrivate *priv;
 
-	if (!gtkblist)
+	if (!list || !list->ui_data)
 		return;
 
+	g_return_if_fail(list->ui_data != gtkblist);
+
 	purple_signals_disconnect_by_handle(gtkblist);
 
 	if (gtkblist->headline_close)