Re: [Vala] g_object_unref in render_icon



On Mon, 2011-10-31 at 14:40 +0100, rastersoft wrote:
Hi all:

I'm working with an IconView and using the render_icon method to add 
icons to it. Checking the Vala documentation, I found at

     http://valadoc.org/gtk+-2.0/Gtk.Widget.render_icon.html

that it says that is mandatory to use g_object_unref after using an icon 
obtained with this method. Do I have to use .unref() method after adding 
it to my IconView, because Vala, in this case won't manage automatically 
the memory, or is it a mistake due to verbatim copying the description 
from GTK documentation? (The "g_object_unref" part points a lot to the 
later).

It's because the documentation is automatically generated from the same
source. That method is correctly marked as transferring ownership in the
VAPI, so Vala will unref it when necessary.

You'll actually see quite a few of these since there is no automated way
to remove them. With GObject Introspection annotations this information
is superfluous (not just in the source documentation, but in the gtk-doc
output as well), so hopefully people will start removing it from the
function descriptions in the near future.


-Evan




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