Re: GObject finalizers

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

 



Hi,

Cedric Marcone <marcone@xxxxxxx> writes:

> sorry if it's a FAQ but, searching the archives, I couldn't find any
> helpful pointers.
> 
> When calling g_object_unref(), refcount is decremented. If it reaches 0,
> GObjectClass->finalize(Gobject *) is called. And that's a damn good
> thing ;)
> 
> If I subclass GObject with a class containg dynamically allocated
> instance vars, I will need to provide my own finalize() to get rid of
> them, and chain the call to "GObjectClass->finalize()".
> 
> The question is how to provide my own instance finalizer and register
> it...

Register a class initializer and install the instance finalizer there.
Have a look at some example code, almost every GObject does it that
way.


Sven

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux