changeset 28422:44cbfcaf9e3a

Fix a crash when sending OIMs on MSN. The callback function used after updating the token was incorrectly defined with void return and could be called again after the timeout (as would normally happen for timeouts that return TRUE). Thanks to Sadrul for getting a good backtrace and finding the real cause. Fixes #8155.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 24 Oct 2009 07:53:02 +0000
parents a335d1bab20e
children 3a8d2927dc2b
files ChangeLog libpurple/protocols/msn/oim.c
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Oct 24 00:59:12 2009 +0000
+++ b/ChangeLog	Sat Oct 24 07:53:02 2009 +0000
@@ -16,6 +16,7 @@
 	* Fix a random crash that might occur when idle.
 	* Fix more FQY 240 connection errors.
 	* Fix a crash that could occur when adding a buddy.
+	* Fix an occasional crash when sending message to an offline user.
 
 	XMPP:
 	* Users connecting to Google Talk now have an "Initiate Chat" context menu
--- a/libpurple/protocols/msn/oim.c	Sat Oct 24 00:59:12 2009 +0000
+++ b/libpurple/protocols/msn/oim.c	Sat Oct 24 07:53:02 2009 +0000
@@ -153,7 +153,7 @@
 	gpointer cb_data;
 } MsnOimRequestData;
 
-static void msn_oim_request_helper(MsnOimRequestData *data);
+static gboolean msn_oim_request_helper(MsnOimRequestData *data);
 
 static void
 msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response,
@@ -202,7 +202,7 @@
 	g_free(data);
 }
 
-static void
+static gboolean
 msn_oim_request_helper(MsnOimRequestData *data)
 {
 	MsnSession *session = data->oim->session;
@@ -224,13 +224,13 @@
 		const char *msn_p;
 
 		token = msn_nexus_get_token(session->nexus, MSN_AUTH_MESSENGER_WEB);
-		g_return_if_fail(token != NULL);
+		g_return_val_if_fail(token != NULL, FALSE);
 
 		msn_t = g_hash_table_lookup(token, "t");
 		msn_p = g_hash_table_lookup(token, "p");
 
-		g_return_if_fail(msn_t != NULL);
-		g_return_if_fail(msn_p != NULL);
+		g_return_val_if_fail(msn_t != NULL, FALSE);
+		g_return_val_if_fail(msn_p != NULL, FALSE);
 
 		passport = xmlnode_get_child(data->body, "Header/PassportCookie");
 		xml_t = xmlnode_get_child(passport, "t");
@@ -248,6 +248,8 @@
 		msn_soap_message_new(data->action, xmlnode_copy(data->body)),
 		data->host, data->url, FALSE,
 		msn_oim_request_cb, data);
+
+	return FALSE;
 }