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

Re: [Vala] TreePath from TreeView.get_cursor() never freed?



When I don't use a weak TreePath, like this:

  TreePath path;
  weak TreeViewColumn focus_column;
  treeview.get_cursor (out path, out focus_column);

I get this error:

error: duplicating TreePath instance, use weak variable or explicitly invoke copy method
    treeview.get_cursor (out path, out focus_column);
                         ^^^^^^^^


--- On Thu, 10/9/08, Yu Feng <rainwoodman gmail com> wrote:

> From: Yu Feng <rainwoodman gmail com>
> Subject: Re: [Vala] TreePath from TreeView.get_cursor() never freed?
> To: gj_alsem yahoo com
> Cc: vala-list gnome org
> Date: Thursday, October 9, 2008, 8:58 AM
> On Sun, 2008-10-05 at 09:39 -0700, Geert Jan wrote:
> > Using a strong TreePath gives an error during
> compilation:
> > 
> > "error: duplicating TreePath instance, use weak
> variable or explicitly invoke copy method"
> 
> Really? Which line is the error on?
> treeview.get_cursor (out path, out focus_column);
> 
> 
> > 
> > --- On Sun, 10/5/08, Yu Feng
> <rainwoodman gmail com> wrote:
> > 
> > > From: Yu Feng <rainwoodman gmail com>
> > > Subject: Re: [Vala] TreePath from
> TreeView.get_cursor() never freed?
> > > To: gj_alsem yahoo com
> > > Cc: vala-list gnome org
> > > Date: Sunday, October 5, 2008, 5:43 PM
> > > On Sun, 2008-10-05 at 06:00 -0700, Geert Jan
> wrote:
> > > > Hello,
> > > > 
> > > > This doesn't seem right to me. When in
> Vala I
> > > write:
> > > > 
> > > >   weak TreePath path;
> > > What about make it strong?
> > > TreePath path;
> > > 
> > > >   weak TreeViewColumn focus_column;
> > > >   treeview.get_cursor (out path, out
> focus_column);
> > > > 
> > > > ...it generates the following C code:
> > > > 
> > > >   GtkTreePath* path;
> > > >   GtkTreeViewColumn* focus_column;
> > > >   path = NULL;
> > > >   focus_column = NULL;
> > > >   gtk_tree_view_get_cursor (GTK_TREE_VIEW
> (treeview),
> > > &path, &focus_column);
> > > > 
> > > > The GtkTreePath* path in the C code is never
> freed,
> > > even though the GTK documentation on
> > > gtk_tree_view_get_cursor() clearly states:
> "The
> > > returned GtkTreePath must be freed with
> gtk_tree_path_free()
> > > when you are done with it."
> > > > 
> > > > Am I missing something or is this a bug in
> Vala?
> > > > 
> > > > 
> > 
> > 
> > 
> >       
> > _______________________________________________
> > Vala-list mailing list
> > Vala-list gnome org
> > http://mail.gnome.org/mailman/listinfo/vala-list


      


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