pidgin: 27f7d38a: Trigger url_fetch_connect_cb() asynchron...

datallah at pidgin.im datallah at pidgin.im
Tue Oct 21 12:16:00 EDT 2008


-----------------------------------------------------------------
Revision: 27f7d38af8dba617aba8109d82e27907cd7d8b41
Ancestor: 31940d02243239ac5ceb41f8893e366df3a6794d
Author: datallah at pidgin.im
Date: 2008-10-21T16:09:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/27f7d38af8dba617aba8109d82e27907cd7d8b41

Modified files:
        libpurple/util.c

ChangeLog: 

Trigger url_fetch_connect_cb() asynchronously when the connection fails
immediately instead of synchronously calling the callback and then returning
NULL, causing a double free.
Fixes #7278

-------------- next part --------------
============================================================
--- libpurple/util.c	812b636964297e9426e1ec7c99903cebfb77d6f8
+++ libpurple/util.c	ff681614ae76941b0cc74202e7fb35448e2a37dc
@@ -3979,6 +3979,13 @@ purple_util_fetch_url_request(const char
 					     callback, user_data);
 }
 
+static gboolean
+url_fetch_connect_failed(gpointer data)
+{
+	url_fetch_connect_cb(data, -1, "");
+	return FALSE;
+}
+
 PurpleUtilFetchUrlData *
 purple_util_fetch_url_request_len(const char *url, gboolean full,
 		const char *user_agent, gboolean http11,
@@ -4016,9 +4023,8 @@ purple_util_fetch_url_request_len(const 
 
 	if (gfud->connect_data == NULL)
 	{
-		purple_util_fetch_url_error(gfud, _("Unable to connect to %s"),
-				gfud->website.address);
-		return NULL;
+		/* Trigger the connect_cb asynchronously. */
+		purple_timeout_add(10, url_fetch_connect_failed, gfud);
 	}
 
 	return gfud;


More information about the Commits mailing list