diff pidgin/gtkaccount.c @ 16391:24bbd7e46bfe

Change the imgstore and by extension, then the buddy icon code to take over the references to icon data instead of calling g_memdup(). This eliminates g_memdup()ing and g_free()ing in ~50% of the callers. For the rest, it's no worse (they now do a g_memdup() instead of the core) and they may be able to be modified in the future to avoid that.
author Richard Laager <rlaager@wiktel.com>
date Wed, 25 Apr 2007 22:23:29 +0000
parents 4fc51a87ce42
children 3be560001d26
line wrap: on
line diff
--- a/pidgin/gtkaccount.c	Wed Apr 25 21:48:56 2007 +0000
+++ b/pidgin/gtkaccount.c	Wed Apr 25 22:23:29 2007 +0000
@@ -199,9 +199,11 @@
 	GdkPixbuf *pixbuf = NULL;
 
 	purple_imgstore_unref(dialog->icon_img);
-	if (data != NULL && len > 0)
-		dialog->icon_img = purple_imgstore_add(data, len, new_icon_path);
-	g_free(data);
+	if (data != NULL)
+		if (len > 0)
+			dialog->icon_img = purple_imgstore_add(data, len, new_icon_path);
+		else
+			g_free(data);
 
 	if (dialog->icon_img != NULL) {
 		GdkPixbufLoader *loader = gdk_pixbuf_loader_new();