changeset 27230:0405276c6698

Fix a lost reference when we only fetch an unknown ext.
author Paul Aurich <paul@darkrain42.org>
date Mon, 22 Jun 2009 22:46:09 +0000
parents ef9e68020265
children e3907cfaeb02
files libpurple/protocols/jabber/caps.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c	Mon Jun 22 21:31:54 2009 +0000
+++ b/libpurple/protocols/jabber/caps.c	Mon Jun 22 22:46:09 2009 +0000
@@ -589,9 +589,7 @@
 	}
 
 	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 @@
 		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 @@
 	}
 
 	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);
 	}
 }