Re: GObject and Gtk+ Finalization



George <jirka 5z com> writes:

> On Sun, Sep 24, 2000 at 11:54:56AM -0400, Owen Taylor wrote:
> > > I'm not actually sure that the whole "object can be used after destroyed"
> > > isn't a bit bogus.  I'm sure gnome-libs objects mostly fail here.  But that's
> > > a different argument.
> > 
> > They'll need to be fixed for GTK+-2.0; it's not hard, we've done
> > it for most or all of the objects in GTK+ already.
> > 
> > The reason for changing the meaning of ::destroy from notification of:
> > 
> >  - Object is going into the destroyed state
> > 
> > to a command:
> > 
> >  - Release all references to the object
> > 
> > Is that this "destroyed state" was confusing and almost everything
> > was broken with respect to it. Most objects were put into an
> > inconsistant state on ::destroy and attempts to use a destroyed
> > object would probably result in segfaults.
> > 
> > The new model is simpler, easier to understand, and easier for
> > those people implementing widgets to get absolutely right. 
> 
> Well regardless of that, how can I release all references to a GObject if I
> never get a destroy signal?

You get a destroy signal for GtkObject, which is what I'm talking about.
 
> 1) By the finalize time things will really be broken, so I can't be sure that
>    the object is even half working
> 2) You can get circular references
> 
> Not to mention that "release all references" at many times is half destroying
> the object really, as the object may depend on holding some references.

All references _to_ the object must be released, not all references
that the object holds. An object should never be created with 
references held _on_ it, so destroying the object basically is just
supposed to put it back into that initial state.

Regards,
                                        Owen




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