changeset 23132:9c0a47402f7a

Unref some gdkpixbufs to plug some memory leaks. References #1187.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 07 May 2008 04:05:19 +0000
parents ac567757d236
children 9aa105267f46
files pidgin/gtkimhtmltoolbar.c pidgin/gtksmiley.c
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkimhtmltoolbar.c	Wed May 07 03:32:43 2008 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Wed May 07 04:05:19 2008 +0000
@@ -630,15 +630,13 @@
 
 	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 @@
 		}
 
 		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));
 		}
 	}
 
--- a/pidgin/gtksmiley.c	Wed May 07 03:32:43 2008 +0000
+++ b/pidgin/gtksmiley.c	Wed May 07 04:05:19 2008 +0000
@@ -449,6 +449,7 @@
 		if (smiley_image != NULL)
 			sized_smiley = gdk_pixbuf_scale_simple(smiley_image,
 					22, 22, GDK_INTERP_HYPER);
+		g_object_unref(G_OBJECT(smiley_image));
 	}