changeset 28913:45123312b7a9

Fix a crash when setting a buddyicon. The patches are to fix the crash that happens when you have yourself in your buddylist, and you try to change the avatar. (the crash has a higher probability of happening when you change it for the first time after restarting pidgin). The idea of the patch is to keep a ref for the insertion in the hash-table, so that lines oscar.c:5551-5553 (and similar code in other prpls) don't create and remove a stored-image, and leave an invalid img in buddyicon.c:pointer_icon_cache
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 27 Jan 2010 21:29:38 +0000
parents c833ae72599b
children 5a64fd0f740b
files libpurple/buddyicon.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/buddyicon.c	Wed Jan 27 21:24:15 2010 +0000
+++ b/libpurple/buddyicon.c	Wed Jan 27 21:29:38 2010 +0000
@@ -716,9 +716,8 @@
 	if (read_icon_file(path, &data, &len))
 	{
 		g_free(path);
-		img = purple_buddy_icon_data_new(data, len, account_icon_file);
-		g_hash_table_insert(pointer_icon_cache, account, img);
-		return img;
+		img = purple_buddy_icons_set_account_icon(account, data, len);
+		return purple_imgstore_ref(img);
 	}
 	g_free(path);
 
@@ -841,9 +840,8 @@
 	if (read_icon_file(path, &data, &len))
 	{
 		g_free(path);
-		img = purple_buddy_icon_data_new(data, len, custom_icon_file);
-		g_hash_table_insert(pointer_icon_cache, node, img);
-		return img;
+		img = purple_buddy_icons_node_set_custom_icon(node, data, len);
+		return purple_imgstore_ref(img);
 	}
 	g_free(path);