Re: Gtk::TreeView::get_cursor() is leaking?



On Mon, 2007-03-12 at 17:45 +0300, Andrew E. Makeev wrote:
> Hi,
> 
> I have used valgrind to test my application for leaking memory.
> So, I've found that Gtk::TreeView::get_cursor() is "definitly leaking"
> when getting path parameter.
> 
> GTK+ doc said that after call to gtk_tree_view_get_cursor() "The
> returned GtkTreePath must be freed with gtk_tree_path_free() when you
> are done with it".
> 
> I don't see that here (treeview.cc):
> 
> void TreeView::get_cursor(TreeModel::Path& path, TreeViewColumn*& focus_column)
> {
>   GtkTreePath* pTreePath = 0;
>   GtkTreeViewColumn* pTreeViewColumn = 0;
>   gtk_tree_view_get_cursor(gobj(), &pTreePath, &pTreeViewColumn);
> 
>   path = TreeModel::Path(pTreePath, true);
>   focus_column = Glib::wrap(pTreeViewColumn);
> }
> 
> Since TreeModel::Path() constructor takes copy of the GtkTreePath, we
> may just add at the end of the get_cursor() function:
> 
> gtk_tree_path_free( pTreePath );
> 
> I am confused that this easy to fix issue saved thru all gtkmm versions.
> So, I would to ask is it a bug or not a bug?

Your logic makes sense to me. Please do try patching it and, if it fixes
things, please submit it in bugzilla.

You might be able to just change the second parameter to
TreeModel::Path.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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