diff libpurple/buddyicon.c @ 25890:9c0337d4b878

Fix the crash/leaks in statusbox *** Plucked rev 0cb6e54b (darkrain42@pidgin.im): 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. Refs #9120. *** Plucked rev d25c9ed7 (darkrain42@pidgin.im): Don't leak image refs in gtkstatusbox and assertion failure in nullprpl purple_imgstore_new_from_file gives us a ref and pidgin_status_box_set_buddy_icon also takes a ref.
author Paul Aurich <paul@darkrain42.org>
date Wed, 06 May 2009 18:58:47 +0000
parents 8282911d5e17
children 01f1929d0936
line wrap: on
line diff
--- a/libpurple/buddyicon.c	Mon May 04 00:12:34 2009 +0000
+++ b/libpurple/buddyicon.c	Wed May 06 18:58:47 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)
 	{