[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Single Page

Top Document: comp.windows.x.intrinsics Frequently Asked Questions (FAQ)
Previous Document: 8. I've done all the above and I still get a BadMatch error. Why?
Next Document: 10. How do I exit but still execute the DestroyCallbacks?


9. Why doesn't my widget get destroyed when I call XtDestroyWidget()?


----------------------------------------------------------------------

See section 2.8 of the Xt specification.

It eventually does get destroyed, just not immediately.  The
Intrinsics destroy a widget in a two-phase process.  First it and all
of its children have a flag set that indicate it is being destroyed.
It is then put on a list of widgets to be destroyed.  This way any
pending X events or further references to that widget can be cleaned
up before the memory is actually freed.  The second phase is then
performed after all callbacks, event handlers, and actions have
completed, before checking for the next X event.  At this point the
list is traversed and each widget's memory is actually free()'d, among
other things.

As some further caveats/trivia, the widgets may be destroyed if the
Intrinsics determine that they have no further references to the
widgets on the list.  If so, then the phase 2 destruction occurs
immediately.  Also, if nested event loops are used, widgets placed on
the destroy list before entering the inner event loop are not
destroyed until returning to the outer event loop.



Top Document: comp.windows.x.intrinsics Frequently Asked Questions (FAQ)
Previous Document: 8. I've done all the above and I still get a BadMatch error. Why?
Next Document: 10. How do I exit but still execute the DestroyCallbacks?

Single Page


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
ware@cis.ohio-state.edu

Last Update October 12 2008 @ 00:10 AM

© 2008 FAQS.ORG. All rights reserved.