Re: [Vala] Floating references
- From: Alberto Mardegan <alberto mardegan canonical com>
- Cc: Vala list <vala-list gnome org>
- Subject: Re: [Vala] Floating references
- Date: Thu, 24 May 2012 15:48:38 +0300
On 05/24/2012 01:22 PM, Luca Bruno wrote:
On Tue, May 15, 2012 at 1:21 PM, Alberto Mardegan <
alberto mardegan canonical com> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]