Re: GObject finalizers

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

 



Thanks Sven,

That's exactly what I did. But I was not sure if it was considered the
right way of doing it.

Some more questions :

1- Why isn't the instance initializer method not handled the same way ?

2- Is there a consensus about the type returned by the constructor
(target type (MyInstanceType) or root type (GObject) or even
intermediate type (GtkWidget))

3- Reading GObject documentation, I can read :
"[GLib Object System provides] a signal system that allows very flexible
user customization of virtual/overridable object methods [...]"
Why isn't the finalizers triggered by signals callbacks ?

I know my newbie questions might sound despairing but I couldn't find
any official documentation on GObject / GType system "best-practices".

Thank you,
--
CÃdric

On Thu, 2003-09-25 at 19:57, Sven Neumann wrote:
> 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

_______________________________________________

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