Mercurial > pidgin
changeset 28864:a7f5aa182400
*** Plucked rev d1026e37e4b82add833d2a302a41c8f84e4e2bbb (cc475d6ed3e62e0458659c41bb58ac72f63d88c9):
Fix a crash when disconnecting with a pending buddy icon fetch request.
We weren't canceling our asynchronous URL fetch
*** Plucked rev 03d1409613057bd402e5659d936f59a6d201a93e (cc475d6ed3e62e0458659c41bb58ac72f63d88c9):
Two changes:
1. If we're about to make another request to fetch an icon then cancel
the first one (if it exists)
2. When freeing a buddy, only attempt to cancel a url request if it is non-NULL
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 07 Jan 2010 23:47:00 +0000 |
parents | 1182e604439c |
children | 9e6105d7acbc |
files | libpurple/protocols/myspace/user.c libpurple/protocols/myspace/user.h |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/user.c Thu Jan 07 23:46:24 2010 +0000 +++ b/libpurple/protocols/myspace/user.c Thu Jan 07 23:47:00 2010 +0000 @@ -70,6 +70,9 @@ if (!user) return; + if (user->url_data != NULL) + purple_util_fetch_url_cancel(user->url_data); + g_free(user->client_info); g_free(user->gender); g_free(user->location); @@ -212,6 +215,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 +380,9 @@ /* 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); + if (user->url_data != NULL) + purple_util_fetch_url_cancel(user->url_data); + 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 Thu Jan 07 23:46:24 2010 +0000 +++ b/libpurple/protocols/myspace/user.h Thu Jan 07 23:47:00 2010 +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,