Re: Destroying a container
- From: Owen Taylor <otaylor redhat com>
- To: gtk-list redhat com
- Subject: Re: Destroying a container
- Date: 08 Nov 1999 10:44:49 -0500
Havoc Pennington <hp@redhat.com> writes:
> On Mon, 8 Nov 1999, Michael wrote:
> >
> > I would like to know if I destroy a container widget (also widgets that are
> > inherited from it) using
> > gtk_widget_destroy(). Will all the widgets inside it be destroyed too?
> >
>
> They will be unreferenced, which means they will be destroyed unless
> you've gone out of your way to increment their reference count.
I think you need to read your own book Havoc :-). The above
is right in that the children will be destroyed, but somewhat
incorrect in detail.
Note that destroying a widget puts it into a "destroyed" state,
but does not actually free the memory - that is a separate
step that occurs when the widgets refcount drops to zero.
Destroying a container widget destroys all the children of the
container.
Destroying the children causes them to be removed from their
parent.
Removing the children from the parent causes them to be unreferenced,
which causes them to be freed unless you've gone out of your
way to increment their reference count.
However, the children will always be destroyed, even if the memory
is not freed. If you want to keep using them you need to remove
them from their parent before destroying the parent.
(Havoc's book does in fact contain good explanations of this
stuff.)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]