pidgin: e9b0a237: Fix a crash when setting a buddyicon.

sadrul at pidgin.im sadrul at pidgin.im
Wed Jan 27 16:30:57 EST 2010


-----------------------------------------------------------------
Revision: e9b0a237a9a8a9b7ab16ee981f22869f8be7c8ce
Ancestor: 4731f8a20970f0d2d92f214bd9975a5dd0459271
Author: sadrul at pidgin.im
Date: 2010-01-27T21:29:38
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e9b0a237a9a8a9b7ab16ee981f22869f8be7c8ce

Modified files:
        libpurple/buddyicon.c

ChangeLog: 

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

-------------- next part --------------
============================================================
--- libpurple/buddyicon.c	39aeb0d2aa3c945dcc003e043ff7eb4fe77173d4
+++ libpurple/buddyicon.c	dfcb1a63291c9d88a755d7d7eb57b41d57c35055
@@ -716,9 +716,8 @@ purple_buddy_icons_find_account_icon(Pur
 	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 @@ purple_buddy_icons_node_find_custom_icon
 	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);
 


More information about the Commits mailing list