pidgin.custom_smiley: 230dccf2: Unref some gdkpixbufs to plug some memor...

sadrul at pidgin.im sadrul at pidgin.im
Wed May 7 00:11:46 EDT 2008


-----------------------------------------------------------------
Revision: 230dccf2c8ea29f62c32e122ea727b9c36cc8d1d
Ancestor: 99be989825c85cad6158ae7dbe1501d65d95774a
Author: sadrul at pidgin.im
Date: 2008-05-07T04:05:19
Branch: im.pidgin.pidgin.custom_smiley
URL: http://d.pidgin.im/viewmtn/revision/info/230dccf2c8ea29f62c32e122ea727b9c36cc8d1d

Modified files:
        pidgin/gtkimhtmltoolbar.c pidgin/gtksmiley.c

ChangeLog: 

Unref some gdkpixbufs to plug some memory leaks. References #1187.

-------------- next part --------------
============================================================
--- pidgin/gtkimhtmltoolbar.c	4974500f465b6c7c24cd17a1c5b81e3927442401
+++ pidgin/gtkimhtmltoolbar.c	6105660bae011611cdcc1c24017d9b495839b8af
@@ -630,15 +630,13 @@ sort_smileys(struct smiley_button_list *
 
 	if (size.width > 24) { /* This is a custom smiley, let's scale it */
 		GdkPixbuf *pixbuf = NULL;
-		GdkPixbuf *resized;
 		GtkImageType type;
 
 		type = gtk_image_get_storage_type(GTK_IMAGE(image));
 
 		if (type == GTK_IMAGE_PIXBUF) {
 			pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image));
-		} 
-		else if (type == GTK_IMAGE_ANIMATION) {
+		} else if (type == GTK_IMAGE_ANIMATION) {
 			GdkPixbufAnimation *animation;
 
 			animation = gtk_image_get_animation(GTK_IMAGE(image));
@@ -647,11 +645,14 @@ sort_smileys(struct smiley_button_list *
 		}
 
 		if (pixbuf != NULL) {
+			GdkPixbuf *resized;
 			resized = gdk_pixbuf_scale_simple(pixbuf, 24, 24,
 					GDK_INTERP_HYPER);
 			image = gtk_image_new_from_pixbuf(resized);
 
 			gtk_widget_size_request(image, &size);
+			g_object_unref(G_OBJECT(pixbuf));
+			g_object_unref(G_OBJECT(resized));
 		}
 	}
 
============================================================
--- pidgin/gtksmiley.c	016e1dc7a68c25d1b60d224e75e68f7819737e92
+++ pidgin/gtksmiley.c	3fadd5ba67a99e74f719ccd0aecf878e991d3ef3
@@ -449,6 +449,7 @@ static void store_smiley_add(PurpleSmile
 		if (smiley_image != NULL)
 			sized_smiley = gdk_pixbuf_scale_simple(smiley_image,
 					22, 22, GDK_INTERP_HYPER);
+		g_object_unref(G_OBJECT(smiley_image));
 	}
 
 


More information about the Commits mailing list