Re: [introspection] struct without copy constructor



On 01/31/2012 04:57 PM, Picca Frédéric-Emmanuel wrote:
In that case the copy method should return a value, what about NULL ?

You should rather return the object itself (same for the refcount case). Glib doesn't have to know what you return is actually the same instance as before.


If your case is not one of those, then you should make it so it is one
of those. Glib needs a way to know your struct won't disappear without
it noticeing.

I do not know about all black magic which is under the hound of
gobject-introspection bindings, so I can not guess whaht is expected by Glib.

This is not black magic, this is just telling glib how to manage your objects as there is no way in C to duplicate a random struct or free it (you can have pointers, etc).

Static and refcounted structs are just special cases of copy/free where the copy is the object itself and you don't need to do anything to free the resources.

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