pidgin: 90138fae: Free the buddy list data some more at sh...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jul 12 01:56:40 EDT 2009


-----------------------------------------------------------------
Revision: 90138fae4d2350d166f730736ecea9ee8e20ecdb
Ancestor: 2d8120de20a5420413ab3fd3145085daa2197297
Author: darkrain42 at pidgin.im
Date: 2009-07-12T02:55:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/90138fae4d2350d166f730736ecea9ee8e20ecdb

Modified files:
        ChangeLog.API libpurple/blist.c libpurple/blist.h
        pidgin/gtkblist.c

ChangeLog: 

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).

-------------- next part --------------
============================================================
--- ChangeLog.API	e4dc3d0a702ea0a60c87f31f107eb70e50d40fc9
+++ ChangeLog.API	84ae5cf6009f85260133c88d4e57f2f203550ee7
@@ -82,9 +82,12 @@ version 2.6.0 (??/??/2009):
 
 		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
============================================================
--- libpurple/blist.c	a186cba632bf7bbd1688dce209ebb46236eafd36
+++ libpurple/blist.c	d64de718d3048a8263c7e6c770fe319d0d055404
@@ -3105,6 +3105,8 @@ purple_blist_uninit(void)
 		purple_blist_sync();
 	}
 
+	purple_blist_destroy();
+
 	node = purple_blist_get_root();
 	while (node) {
 		next_node = node->next;
@@ -3112,10 +3114,14 @@ purple_blist_uninit(void)
 		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());
 }
============================================================
--- libpurple/blist.h	9580da3d4ae9096b2e4b8cbb88ca57a84f03f901
+++ libpurple/blist.h	15ec6aaf213a433927c2461893586c0c579e1112
@@ -235,6 +235,7 @@ extern "C" {
  * 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 @@ PurpleBuddyList *purple_blist_new(void);
  * 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 @@ void purple_blist_show(void);
 
 /**
  * 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);
 
============================================================
--- pidgin/gtkblist.c	1663857b8815d1af6a98bd840a45678e5f5ab5e5
+++ pidgin/gtkblist.c	6fa12c8e76cb953abe15c3b848266b30e5fd309c
@@ -6714,14 +6714,15 @@ static void pidgin_blist_update(PurpleBu
 #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)


More information about the Commits mailing list