Re: [gtk-list] Re: Tracking object deletion



On 11 Dec 1997, Owen Taylor wrote:

> 
> Kenneth Albanowski <kjahds@kjahds.com> writes:
> 
> > What's the proper way (if any) to get a function invoked when a GtkObject
> > (or descendant) is being destroyed?

> So it would simply be incorrect to do anything that needed to refer
> to the widget when the "destroy" signal is invoked - and so the
> "destroy" signal is what you are looking for.
> 

ok, i just figured on #gimp, that this statement produced some confusion.
the gtk-users destroy handler wil definitively be invoked *before* the actual
object data is free()d.
there is not much that can be done to/with an object in the destroy handler,
since its x-window will be already detroyed, the style is unattached, the
widget->name is already free()d, there is no valid allocation data left or
similar things.
but, one thing still works, that is gtk_object_get_data() or
gtk_object_get_user_data() will still return correct values. this can be
used to e.g. release private data.
if this wouldn't be the case, there would actually not be much point in
having a destroy handler at all.
also with the new reference counting scheme, the ability to retrive private
data will be preserved in the destroy signal. it will just not be invoked
on a gtk_object_destroy() call but when the reference count drops to zero.

> Regards,
>                                         Owen

---
ciaoTJ



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