changeset 22185:bc2e96c13556

We need to store the img in the hashtable only after we have removed the old one. Otherwise, we end up removing the new img. This fixes a crash when setting the buddyicon from the account specific statusboxes. Some of the prpls unref the img's (a41a12c3718fde3c2e793af5ad8f093942ba2802) without having ref'ed them first. I think fixing that would be a better and more correct solution.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 23 Jan 2008 05:16:39 +0000
parents 2f805b1efc9a
children d1b8c8bef05b 5862bb4be826
files libpurple/buddyicon.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/buddyicon.c	Wed Jan 23 04:47:04 2008 +0000
+++ b/libpurple/buddyicon.c	Wed Jan 23 05:16:39 2008 +0000
@@ -701,11 +701,6 @@
 	}
 	unref_filename(old_icon);
 
-	if (img)
-		g_hash_table_insert(pointer_icon_cache, account, img);
-	else
-		g_hash_table_remove(pointer_icon_cache, account);
-
 	if (purple_account_is_connected(account))
 	{
 		PurpleConnection *gc;
@@ -729,6 +724,11 @@
 	}
 	g_free(old_icon);
 
+	if (img)
+		g_hash_table_insert(pointer_icon_cache, account, img);
+	else
+		g_hash_table_remove(pointer_icon_cache, account);
+
 	return img;
 }