Re: [Vala] GLib.List



Hi,

2011/5/18 Jan Spurný <JSpurny seznam cz>:
Did you have any problem with the following? it should be the first
thing you try (and is likely the correct thing):

[CCode (cheader_filename = "oldlib.h")]
public static GLib.List<X> old_lib_make_x_list();

Thanks for your reply, but unfortunately, it really WAS the first thing I did
- but because X is not reference counted, it resulted in errors like this:

oldlib.vapi:61.33-61.36: error: duplicating X instance, use unowned variable or explicitly invoke copy 
method
       public static GLib.List<X> old_lib_make_x_list();
                               ^

Yeah, this error message is misleading. You should put unowned in your
loop and not in the bindings, i.e.

foreach(unowned X myx in old_lib_make_x_list()) {
    ...
}

HTH,
Abderrahim



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