Re: BonoboXObject refcounting



Michael Meeks <michael ximian com> writes:

> > IMHO this is already extremely ugly and hackish with GTK+ 1.x and just
> > wrong with GObject. With GObject, you cannot "block" the finalizing of
> > an object; this means, once the "finalize" method of a GObject is
> > called, this object _will_ go away after the finalizing handler
> > returns.
> 
>         Dude !? I don't quite understand what you mean by "you can't just
> block it". Unless things are substantialy different, you can simply
> override the finalize method and refuse to chain to your parent - just    
> like with GtkObject, which is essentialy what we do - keeping the
> GtkObject around until the ORB doesn't need it anymore.

This doesn't work with glib 2.0.  The GObject is freed when your ref
count reaches zero.  Failure to chain to the parent finalizer just
results in unfreed memory.  If you really want to avoid shutting down,
you can rereference the object in the GObject::shutdown method, which
will prevent the instance from being freed.  Who owns this ref now is an
issue for people other then me...

Thanks,
-Jonathan




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