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



On Sat, 2008-10-11 at 14:50 -0700, Geert Jan wrote:
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);
                         ^^^^^^^^

Yes, you should use a strong reference for the Gtk.TreePath parameter.
This is a bug[1] in the gtk+-2.0.vapi file.

The current signature in Gtk.TreeView reads:
        public void get_cursor (out weak Gtk.TreePath path, out weak
Gtk.TreeViewColumn focus_column);
        
While it should be something like:
        public void get_cursor (out Gtk.TreePath? path, out weak
Gtk.TreeViewColumn? focus_column);

The vala api files for GObject based libraries are automatically
generated through introspection. But sometimes there is not enough
information on how to use the parameters correctly, so these additional
attributes are added in a metafile as described in the wiki[2]. For most
api's it should be ok, but it's always possible some parameters need
additional information which isn't there yet. If you encounter similar
problems feel free to file a bug at http://bugzilla.gnome.org/.

Hans

[1] http://bugzilla.gnome.org/show_bug.cgi?id=555972
[2] http://live.gnome.org/Vala/Bindings





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