cpw.darkrain42.xmpp.disco: 2dd83860: Clean up Jabber's references and protoco...

paul at darkrain42.org paul at darkrain42.org
Sat Apr 25 16:16:26 EDT 2009


-----------------------------------------------------------------
Revision: 2dd83860c4947720361945ae2299a3a295dfae2a
Ancestor: 5718640f5c3ffb0d9ff0fea50bd78278e248f0a4
Author: paul at darkrain42.org
Date: 2009-03-31T05:40:13
Branch: im.pidgin.cpw.darkrain42.xmpp.disco
URL: http://d.pidgin.im/viewmtn/revision/info/2dd83860c4947720361945ae2299a3a295dfae2a

Modified files:
        libpurple/protocols/jabber/disco.c

ChangeLog: 

Clean up Jabber's references and protocol_data if the window is closed

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/disco.c	f4564ea7af56293a38c25cea6c797fee1aa407ee
+++ libpurple/protocols/jabber/disco.c	464c72e8225d77cd282b3343a512c4d34115ec4f
@@ -655,6 +655,13 @@ jabber_disco_service_items_cb(JabberStre
 
 	--list_data->fetch_count;
 
+	if (list_data->list == NULL) {
+		if (list_data->fetch_count == 0)
+			jabber_disco_list_data_destroy(list_data);
+
+		return;
+	}
+
 	if (!from || !result || !query || strcmp(result, "result") != 0) {
 		if (list_data->fetch_count == 0)
 			purple_disco_list_set_in_progress(list, FALSE);
@@ -743,6 +750,13 @@ jabber_disco_service_info_cb(JabberStrea
 
 	--list_data->fetch_count;
 
+	if (list_data->list == NULL) {
+		if (list_data->fetch_count == 0)
+			jabber_disco_list_data_destroy(list_data);
+
+		return;
+	}
+
 	if (!from || !result || strcmp(result, "result") != 0
 			|| (!(query = xmlnode_get_child(packet, "query")))
 			|| (!(ident = xmlnode_get_child(query, "identity")))) {
@@ -981,9 +995,16 @@ jabber_disco_cancel(PurpleDiscoList *lis
 	if (list_data->fetch_count == 0) {
 		/* Nothing outstanding, just free it now... */
 		jabber_disco_list_data_destroy(list_data);
-	} else
-		/* We'll free it when the count is 0 */
+	} else {
+		int i;
+		/* Lose all our references to the PurpleDiscoList */
+		for (i = 0; i < list_data->fetch_count; ++i) {
+			purple_disco_list_unref(list);
+		}
+
+		/* We'll free list_data when fetch_count is down to 0 */
 		list_data->list = NULL;
+	}
 }
 
 int


More information about the Commits mailing list