[anjal: 5/6] Fix leak of cell renderers in MailFolderView



commit 535cdb6000b8ca4fdc372cb0fcc9acd899147d2e
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Thu Oct 8 11:42:07 2009 -0500

    Fix leak of cell renderers in MailFolderView
    
    valgrind log:
    ==28114== 7,728 (288 direct, 7,440 indirect) bytes in 3 blocks are definitely lost in loss record 13,093 of 13,221
    ==28114==    at 0x4C221A7: malloc (vg_replace_malloc.c:195)
    ==28114==    by 0xE747552: g_malloc (gmem.c:131)
    ==28114==    by 0xE75D3C7: g_slice_alloc (gslice.c:824)
    ==28114==    by 0xE75D6F5: g_slice_alloc0 (gslice.c:833)
    ==28114==    by 0xE2E962F: g_type_create_instance (gtype.c:1654)
    ==28114==    by 0xE2CE74A: g_object_constructor (gobject.c:1338)
    ==28114==    by 0xE2CEDBC: g_object_newv (gobject.c:1215)
    ==28114==    by 0xE2CF906: g_object_new_valist (gobject.c:1278)
    ==28114==    by 0xE2CFA4B: g_object_new (gobject.c:1060)
    ==28114==    by 0x428AC8: custom_cell_renderer_toggle_pixbuf_new (custom-cell-renderer-toggle-pixbuf.c:201)
    ==28114==    by 0x425326: mail_folder_view_construct (mail-folder-view.c:1635)
    ==28114==    by 0x425BEB: mail_folder_view_new (mail-folder-view.c:1831)
    ==28114==    by 0x41F5BD: mail_view_add_folder (mail-view.c:340)
    ==28114==    by 0x42019F: mail_view_add_page (mail-view.c:531)
    ==28114==    by 0x4202FE: mv_switch_folder_view (mail-view.c:580)
    ==28114==    by 0x42042B: mail_view_set_folder_uri (mail-view.c:606)
    ==28114==    by 0x41B5B5: folder_selected_cb (mail-component.c:405)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=599793

 src/mail-folder-view.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 0213673..6d317a9 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -303,6 +303,11 @@ mail_folder_view_finalize (GObject *object)
 {
 	 MailFolderView *mfv = (MailFolderView  *)object;
 
+	 if (mfv->priv->unread_toggle)
+		 g_object_unref (mfv->priv->unread_toggle);
+	 if (mfv->priv->from_to)
+		 g_object_unref (mfv->priv->from_to);
+
 	 if (mfv->priv->folder_name)
 		 g_free (mfv->priv->folder_name);
 
@@ -1641,7 +1646,7 @@ mail_folder_view_construct (MailFolderView *shell)
 	else 
 		g_object_set_data ((GObject *)cell, "data", GINT_TO_POINTER (EMTS_COL_UNREAD));
 	custom_cell_renderer_vbox_append (vbox, cell);
-	shell->priv->unread_toggle = cell; /* Store the cell_render */
+	shell->priv->unread_toggle = g_object_ref_sink (cell); /* Store the cell_render */
 	g_object_set_data ((GObject *)cell, "mfv", shell);
 
 	/* dummy renderers for nice packing */
@@ -1684,7 +1689,7 @@ mail_folder_view_construct (MailFolderView *shell)
 		g_object_set_data ((GObject *)cell, "data", GINT_TO_POINTER (COL_FROM));
 	else 
 		g_object_set_data ((GObject *)cell, "data", GINT_TO_POINTER (EMTS_COL_FROM));
-	shell->priv->from_to = cell;
+	shell->priv->from_to = g_object_ref_sink (cell);
 	g_object_set_data ((GObject *)cell, "p-ellipsize", GINT_TO_POINTER (1));
 	g_object_set_data ((GObject *)cell, "p-markup", GINT_TO_POINTER (1));
 	g_object_set_data ((GObject *)cell, "p-bold", GINT_TO_POINTER (0));



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