[anjal: 3/6] Fix leak in CustomCellRendererVBox



commit 18d59e995ee9ef1afe5ad5a356eb3f06d283cb1c
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Wed Oct 7 22:02:12 2009 -0500

    Fix leak in CustomCellRendererVBox
    
    Children were not freed:
    ==24387== 14,512 (48 direct, 14,464 indirect) bytes in 2 blocks are definitely lost in loss record 13,186 of 13,267
    ==24387==    at 0x4C221A7: malloc (vg_replace_malloc.c:195)
    ==24387==    by 0xE747552: g_malloc (gmem.c:131)
    ==24387==    by 0xE75D3C7: g_slice_alloc (gslice.c:824)
    ==24387==    by 0xE73CFD5: g_list_append (glist.c:122)
    ==24387==    by 0x427F89: custom_cell_renderer_vbox_append (custom-cell-renderer-vbox.c:269)
    ==24387==    by 0x42539A: mail_folder_view_construct (mail-folder-view.c:1649)
    ==24387==    by 0x425B67: mail_folder_view_new (mail-folder-view.c:1831)
    ==24387==    by 0x41F539: mail_view_add_folder (mail-view.c:340)
    ==24387==    by 0x42011B: mail_view_add_page (mail-view.c:531)
    ==24387==    by 0x42027A: mv_switch_folder_view (mail-view.c:580)
    ==24387==    by 0x4203A7: mail_view_set_folder_uri (mail-view.c:606)
    ==24387==    by 0x41B531: folder_selected_cb (mail-component.c:405)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=599793

 src/custom-cell-renderer-vbox.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/custom-cell-renderer-vbox.c b/src/custom-cell-renderer-vbox.c
index 2756a93..abc4c4c 100644
--- a/src/custom-cell-renderer-vbox.c
+++ b/src/custom-cell-renderer-vbox.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)
  *
  */
 
@@ -183,9 +184,9 @@ custom_cell_renderer_vbox_class_init (CustomCellRendererVBoxClass *klass)
 static void
 custom_cell_renderer_vbox_finalize (GObject *object)
 {
-/*
   CustomCellRendererVBox *cellrendererprogress = CUSTOM_CELL_RENDERER_VBOX(object);
-*/
+  g_list_foreach (cellrendererprogress->children, (GFunc)g_object_unref, NULL);
+  g_list_free (cellrendererprogress->children);
 
   /* Free any dynamically allocated resources here */
 
@@ -266,7 +267,7 @@ custom_cell_renderer_vbox_append (GtkCellRenderer *cell, GtkCellRenderer *child)
 {
 	
   CustomCellRendererVBox *cellprogress = CUSTOM_CELL_RENDERER_VBOX (cell);
-  cellprogress->children = g_list_append (cellprogress->children, child);
+  cellprogress->children = g_list_append (cellprogress->children, g_object_ref_sink (child));
 }
 
 static void



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