Re: GTK_DESTROYED not set after gtk_object_destroy() ?



On Sun, 2001-10-07 at 22:12, Murray Cumming wrote:
> On Sun, 2001-10-07 at 21:53, Owen Taylor wrote:
> > 
> > murrayc t-online de (Murray Cumming) writes:
> > 
> > > Gtk-- needs to know whether objects have been destroyed, and we would
> > > normally just check for the GTK_DESTROYED flag. But it seems to be unset
> > > at the end of gtk_object_dispose(), which is called indirectly by
> > > gtk_object_destroy() and g_object_unref().
> > > 
> > > Have I misread the code?
> > > 
> > > I guess that we can catch the destroyed signal instead, but the flag
> > > would be simpler.
> > 
> > There _are_ no destroyed objects in GTK+-2.0. The gtk_widget_destroy()
> > operation indicates "release all references to this object" and
> > is used in conjunction with reference counting to avoid the reference
> > count loops that pure reference counting leads to, especially
> > when combined with language bindings that automatically reference
> > count objects.
> 
> Well, we need to know when that has happened so that we can release
> resources, so I guess we'll just catch the GtkObject::destroy signal and
> store a boolean. Thanks.

Actually, I discovered that GtkObject::destroy is emitted more than
once, and that GtkObject uses its resources after the first destroy is
ommitted. For instance, GtkContainer::remove() is called after the
gtk_object_destroy() has been called on the container.

So it seemed sensible to use the GDestroyNotify callback that's given to
g_object_set_data_full(), because that is called indirectly from
gtk_object_dispose(), which only seems to be called after the last
destroy. I'm not sure that GDestroyNotify is such a good name..

BUT
I now find that gtk_object_dispose() does not run when I call
gtk_object_destroy(). Is it possible that gtk_object_destroy() doesn't
always destroy the GtkObject?

OR
How can I tell the GtkObject that it shouldn't use any of it's
callbacks, so that I can safely free the C++ wrapper instance.


> 
> -- 
> Murray Cumming
> murrayc usa net
> www.murrayc.com
> 
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 
> 
-- 
Murray Cumming
murrayc usa net
www.murrayc.com





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