[grisbi-devel] [PATCH 09/15] Fix leak of 'navigation_model' gsb_gui_navigation_create_navigation_pane()
RĂ©mi Cardona
remi at gentoo.org
Sat Mar 9 16:54:01 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.
In this case, the fix is correct but not satisfactory as we keep using
the 'global' static pointer without properly holding a reference.
---
src/navigation.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/navigation.c b/src/navigation.c
index 32706a1..77fc1ce 100644
--- a/src/navigation.c
+++ b/src/navigation.c
@@ -251,6 +251,9 @@ GtkWidget *gsb_gui_navigation_create_navigation_pane ( void )
gtk_tree_selection_set_mode ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( navigation_tree_view ) ),
GTK_SELECTION_SINGLE );
gtk_tree_view_set_model ( GTK_TREE_VIEW ( navigation_tree_view ), GTK_TREE_MODEL( navigation_model ) );
+ /* FIXME, since navigation_model is a static variable, we _do_ hold a ref...
+ Maybe we should be using a WeakRef? */
+ g_object_unref ( G_OBJECT ( navigation_model ) );
/* Handle drag & drop */
navigation_dst_iface = GTK_TREE_DRAG_DEST_GET_IFACE ( navigation_model );
--
1.8.1.4
More information about the devel
mailing list