Re: [Vala] Is IconView.get_selected_items () memory leak?



On Fri, Jan 15, 2010 at 21:11:14 +0800, xiaohu wrote:
I have below vala code:

  public void on_iconview_selection_changed (IconView iconview)
    {   
      unowned List list = iconview.get_selected_items (); 
        ^^^^^^^
        Obviously the list must be owned to have vala free it. The fact, that
        this gets compiler indicates, that the binding returns unowned list,
        which contradicts the documentation (quoted below).

[...]

the gtk_icon_view_get_selected_items() document say the result must be
free as below:

g_list_foreach (list, gtk_tree_path_free, NULL);
g_list_free (list);

is this a memory leak? how to fix it?

Judging from your code sample, the binding declares the return value
incorrectly unowned where it in fact is owned. Can anybody confirm it?

Regards,
Jan

-- 
                                                 Jan 'Bulb' Hudec <bulb ucw cz>



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