[Vala] Some basic questions



1:

If I want a copy of Gtk.TreePath I have to use weak but the problem is 
howto free it after use?

TreePath a;
weak TreePath b;

b=a.copy();
b.[free/unref] <- does not work.


2:

Another problem probadly a binding bug:

weak List selection = tw.get_selection().get_selected_rows();

Because of the weak ref vala will not free the object but howto free it
manually then??

Also tried this:

List selection = tw.get_tree_selection().get_selected_rows();

but it didnt compile.

3: Also the model parameter should not be unrefed
         
TreeModel model;
selections=treeviewPlaylist.get_selection().get_selected_rows( out
model);
if (selection)
  return ;

C code will generate:

GtkTreeModel *model;

....(&model)
if (selection == NULL) {
        g_object_unref(model);  <- WRONG should not unref model
        return 0; 
}

adding a weak reference fixes the issue but should vala give a warning
or is the binding wrong?


Greets

Mikael Hermansson




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