diff libpurple/buddyicon.c @ 26903:1a1c12c122c9

Look up the old image before we store the new one in the hash table. Looking up the new image and then unref:ing it (hence freeing the data and subsequently returning it) is not good. This was causing problems with changing buddy icons while using mystatusbox. Closes #9120.
author Paul Aurich <paul@darkrain42.org>
date Wed, 06 May 2009 06:40:24 +0000
parents dc05a7128d88
children 01f1929d0936
line wrap: on
line diff
--- a/libpurple/buddyicon.c	Mon May 04 15:47:54 2009 +0000
+++ b/libpurple/buddyicon.c	Wed May 06 06:40:24 2009 +0000
@@ -753,6 +753,8 @@
 	}
 	unref_filename(old_icon);
 
+	old_img = g_hash_table_lookup(pointer_icon_cache, account);
+
 	if (img)
 		g_hash_table_insert(pointer_icon_cache, account, img);
 	else
@@ -770,7 +772,7 @@
 			prpl_info->set_buddy_icon(gc, img);
 	}
 
-	if ((old_img = g_hash_table_lookup(pointer_icon_cache, account)))
+	if (old_img)
 		purple_imgstore_unref(old_img);
 	else if (old_icon)
 	{