[anjal: 2/6] Fix a couple major pixbuf leaks



commit 81d63c5e2cdd5cf7e5739c363f26e6aa626138e5
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Wed Oct 7 17:25:07 2009 -0500

    Fix a couple major pixbuf leaks
    
    According to valgrind, in my basic run, these leaks added up to about 640k of
    definitely lost memory
    
    https://bugzilla.gnome.org/show_bug.cgi?id=599793

 src/mail-folder-view.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 9d59921..0213673 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -17,6 +17,7 @@
  *		Srinivasa Ragavan <sragavan novell com>
  *
  * Copyright (C) 2009 Novell, Inc. (www.novell.com)
+ * Copyright (C) 2009 Intel Corporation (www.intel.com)
  *
  */
 
@@ -699,8 +700,11 @@ draw_img (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *t
 		  if (data) {
 			  img = gtk_widget_render_icon (wid, data, GTK_ICON_SIZE_MENU, NULL);
 			  g_object_set ((GObject *)child, "pixbuf", img, NULL);
+			  g_object_unref (img);
 		  } else {
-			  g_object_set ((GObject *)child, "pixbuf", gdk_pixbuf_new_from_xpm_data ((const char **) empty_xpm), NULL);
+			  GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) empty_xpm);
+			  g_object_set ((GObject *)child, "pixbuf", pixbuf, NULL);
+			  g_object_unref (pixbuf);
 		  }
 		  tmp = tmp->next;
 	}
@@ -901,9 +905,13 @@ draw_text (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *
 						 
 						 gtk_tree_model_get_value (tree_model, iter, EMTS_COL_ATTACHMENT, &v1);
 						 if (g_value_get_boolean (&v1)) {
-			 				g_object_set ((GObject *)c, "pixbuf", mail_utils_get_icon("mail-attachment", GTK_ICON_SIZE_MENU), NULL);
+							GdkPixbuf *icon = mail_utils_get_icon("mail-attachment", GTK_ICON_SIZE_MENU);
+			 				g_object_set ((GObject *)c, "pixbuf", icon, NULL);
+							g_object_unref (icon);
 		  				 } else {
-			  				g_object_set ((GObject *)c, "pixbuf", gdk_pixbuf_new_from_xpm_data ((const char **) empty_xpm), NULL);
+							GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) empty_xpm);
+			  				g_object_set ((GObject *)c, "pixbuf", pixbuf, NULL);
+							g_object_unref (pixbuf);
 		  				 }
 					}
 					i=-1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]