On 05/24/2012 01:22 PM, Luca Bruno wrote:
> On Tue, May 15, 2012 at 1:21 PM, Alberto Mardegan <
> [email protected]> wrote:
>
>> ========
>> [ CCode ( returns_floating_reference = true ) ]
>> public override unowned Gtk.Widget build_widget () {
>> return new Gtk.Label ("Hello world!");
>> }
>> ========
>>
>> but the code doesn't compile: "Return value transfers ownership but
>> method return type hasn't been declared to transfer ownership". If I
>> introduce a member variable to hold the GtkWidget then it works, but the
>> generated C code still calls g_object_ref_sink().
>>
>> It seems that the "returns_floating_reference" does nothing, or I didn't
>> understand how to use it?
>>
>
> The return type must be still owned.
Do you mean that the Vala declaration of the method should be
public override owned Gtk.Widget build_widget ();
instead?
I'm confused because GObject Introspection considers "(transfer
floating)" an alias for "(transfer none)". Which seems wrong to me,
because there's a big difference between the two. :-)
Ciao,
Alberto
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list