Re: GObject: Freeing memory of instance members?

On Thu, May 03, 2007 at 08:16:23PM -0300, Alexandre Moreira wrote:
> At your class_init you should peek (g_type_class_peek_parent, using
> your class pointer as parameter) a pointer to your parent class and
> keep it in a global storage, accessible to your finalize.

Actually, what you should do is to use a macro from the
G_DEFINE_TYPE() family that does these things automaticaly
(the parent class variable is named <my_type>_parent_class).

> Then, in your finalize method you call the finalize method on this
> pointer you just got from peek_parent, something like:
> G_OBJECT_CLASS(parent_class)->finalize(pointer_to_the_object_being_finalized);

This still holds, except for the name.



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