pidgin: 5b8bc8da: Fix a lost reference when we only fetch ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Mon Jun 22 19:45:33 EDT 2009


-----------------------------------------------------------------
Revision: 5b8bc8dab93ef4b7764475ec085446f0d20e90e2
Ancestor: 74c00c33cab0e208691543b25eeae7906f6e4181
Author: darkrain42 at pidgin.im
Date: 2009-06-22T22:46:09
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5b8bc8dab93ef4b7764475ec085446f0d20e90e2

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

ChangeLog: 

Fix a lost reference when we only fetch an unknown ext.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/caps.c	5b4d2e178a08e1604feb7098410724677149b929
+++ libpurple/protocols/jabber/caps.c	e8930893f67120841c0ccd8906ab583ed2941cf8
@@ -589,9 +589,7 @@ void jabber_caps_get_info(JabberStream *
 	}
 
 	userdata = g_new0(jabber_caps_cbplususerdata, 1);
-	/* This ref is given to fetching the basic node#ver info if we need it
-	 * or unrefed at the bottom of this function */
-	cbplususerdata_ref(userdata);
+	/* We start out with 0 references. Every query takes one */
 	userdata->cb = cb;
 	userdata->cb_data = user_data;
 	userdata->who = g_strdup(who);
@@ -617,6 +615,8 @@ void jabber_caps_get_info(JabberStream *
 		g_free(nodever);
 		xmlnode_set_attrib(iq->node, "to", who);
 
+		cbplususerdata_ref(userdata);
+
 		jabber_iq_set_callback(iq, jabber_caps_client_iqcb, userdata);
 		jabber_iq_send(iq);
 	}
@@ -669,7 +669,11 @@ void jabber_caps_get_info(JabberStream *
 	}
 
 	if (userdata->info && userdata->extOutstanding == 0) {
+		/* We have everything we need right now */
 		jabber_caps_get_info_complete(userdata);
+
+		/* We need to destroy the structure, but it has 0 refs, so fake it. */
+		userdata->ref = 1;
 		cbplususerdata_unref(userdata);
 	}
 }


More information about the Commits mailing list