in
out
in-out
null-ok (for parameters and return values) and optional (for parameters)
caller-owns: A function returns a GObject and has added a reference to it
GObject *i = my_type_get_the_i (mytype);
g_object_unref (i);
GObject * my_type_get_the_i (MyType *self)
{
return g_object_ref (the_cached_i);
}
GObject * my_type_get_the_i (MyType *self)
{
return my_i_new ();
}
callee-owns: A function requires a GObject as parameter and will claim ownership
void my_type_set_the_i (MyType *self, GObject *i)
{
if (the_cached_i)
g_object_unref (i);
the_cached_i = i;
}
not this!
void my_type_set_the_i (MyType *self, GObject *i)
{
if (the_cached_i)
g_object_unref (i);
the_cached_i = g_object_ref (i);
}