Re: [Vala] evangelise talloc for vala memory management



On Tue, 2008-07-15 at 11:05 +0100, Sam Liddicott wrote:
The reference counting that "vala" supports is only for gobject; which
is fine, but the glib vapi file shows that this is done by the vapi
file and not by vala as such.

[CCode (ref_function = "g_object_ref", unref_function =
"g_object_unref", marshaller_type_name = "OBJECT", get_value_function
= "g_value_get_object", set_value_function = "g_value_set_object",
cheader_filename = "glib-object.h")]

I'll want to introduce a new object base for Samba4 that uses talloc
functions to do this, and it looks like I can; and so I plan to, but I
invite wiser folk to comment first:

1. are these CCode attributes inherited to subclasses?

Yes, memory management functions are inherited.

2. are their any secrets pertaining to the C code generated by '#' and
'weak' and the CCode attributes above that would be helpful for me to
know?

In general, `weak` and `#` is not visible in the generated C code,
except for the actual memory management calls, of course.

3. what does get_value_function do, and what Vala code makes use of
it?

That's used if you want to use instances of the class as a GValue, e.g.
that's needed for GObject properties. Can usually be avoided in
non-GObject bindings.

4. do I need to worry about marshaller_type_name?

That's mainly used for signals parameters. If you don't want to use your
objects as signal arguments, you don't need that.

Juerg




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