pidgin: d1026e37: Fix a crash when disconnecting with a pe...

markdoliner at pidgin.im markdoliner at pidgin.im
Tue Dec 15 21:45:43 EST 2009


-----------------------------------------------------------------
Revision: d1026e37e4b82add833d2a302a41c8f84e4e2bbb
Ancestor: a8e67ade069e5f4729d237329f0b3d3832b6d6ba
Author: markdoliner at pidgin.im
Date: 2009-12-12T01:17:57
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d1026e37e4b82add833d2a302a41c8f84e4e2bbb

Modified files:
        libpurple/protocols/myspace/user.c
        libpurple/protocols/myspace/user.h

ChangeLog: 

Fix a crash when disconnecting with a pending buddy icon fetch request.
We weren't canceling our asynchronous URL fetch

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/user.c	b902e0a2214de7f9c2312e75cda3ad6c7a1fc49a
+++ libpurple/protocols/myspace/user.c	e18acc6e994e53087fa429059fd3a4332a414d9a
@@ -70,6 +70,8 @@ void msim_user_free(MsimUser *user)
 	if (!user)
 		return;
 
+	purple_util_fetch_url_cancel(user->url_data);
+
 	g_free(user->client_info);
 	g_free(user->gender);
 	g_free(user->location);
@@ -212,6 +214,8 @@ msim_downloaded_buddy_icon(PurpleUtilFet
 	const char *name = purple_buddy_get_name(user->buddy);
 	PurpleAccount *account;
 
+	user->url_data = NULL;
+
 	purple_debug_info("msim_downloaded_buddy_icon",
 			"Downloaded %" G_GSIZE_FORMAT " bytes\n", len);
 
@@ -375,7 +379,7 @@ msim_store_user_info_each(const gchar *k
 
 		/* Only download if URL changed */
 		if (!previous_url || !g_str_equal(previous_url, user->image_url)) {
-			purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, msim_downloaded_buddy_icon, (gpointer)user);
+			user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, msim_downloaded_buddy_icon, (gpointer)user);
 		}
 	} else if (g_str_equal(key_str, "LastImageUpdated")) {
 		/* TODO: use somewhere */
============================================================
--- libpurple/protocols/myspace/user.h	7c8a6aa909751831656cc942c610832c3ac0e9b0
+++ libpurple/protocols/myspace/user.h	e79024c441cb982f1184e0ec14f09fa81eef1d2b
@@ -40,6 +40,7 @@ typedef struct _MsimUser
 	gchar *image_url;
 	guint last_image_updated;
 	gboolean temporary_user;
+	PurpleUtilFetchUrlData *url_data;
 } MsimUser;
 
 /* Callback function pointer type for when a user's information is received,


More information about the Commits mailing list