Re: [Vala] Floating references



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.

-- 
www.debian.org - The Universal Operating System


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