[grisbi-devel] [PATCH 10/15] Fix leak of 'pixbuf' gsb_gui_navigation_update_account_iter()

RĂ©mi Cardona remi at gentoo.org
Sat Mar 9 16:54:02 CET 2013


GObject-derived types are created with a reference count of 1 (unlike
GInitiallyUnowned-derived types which are created with a floating ref)
so they need to be unref()ed explicitly at some point.

Since the GtkTreeStore increments the reference count, we can unref() the
pixbuf after adding it to the store.
---
 src/navigation.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/navigation.c b/src/navigation.c
index 77fc1ce..cb67b57 100644
--- a/src/navigation.c
+++ b/src/navigation.c
@@ -1984,6 +1984,7 @@ void gsb_gui_navigation_set_navigation_pages ( GtkTreeModel *model,
                         NAVIGATION_ORDRE, ordre,
                         -1);
 
+    g_object_unref ( G_OBJECT ( pixbuf ) );
     g_free ( tmp_str );
     g_free ( title );
 
-- 
1.8.1.4



More information about the devel mailing list