changeset 29187:57612c4d495b

Fix a crash when disconnecting with a pending buddy icon fetch request. We weren't canceling our asynchronous URL fetch
author Mark Doliner <mark@kingant.net>
date Sat, 12 Dec 2009 01:17:57 +0000
parents ef43e6df5fdc
children fc30836fb714
files libpurple/protocols/myspace/user.c libpurple/protocols/myspace/user.h
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/user.c	Fri Dec 11 19:58:46 2009 +0000
+++ b/libpurple/protocols/myspace/user.c	Sat Dec 12 01:17:57 2009 +0000
@@ -70,6 +70,8 @@
 	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 @@
 	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 @@
 
 		/* 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 */
--- a/libpurple/protocols/myspace/user.h	Fri Dec 11 19:58:46 2009 +0000
+++ b/libpurple/protocols/myspace/user.h	Sat Dec 12 01:17:57 2009 +0000
@@ -40,6 +40,7 @@
 	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,