Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!husc6!bbn!mit-eddie!rutgers!apple!bionet!agate!ucbvax!hplabs!hp-pcd!hpcvlx!fred From: fred@hpcvlx.HP.COM (Fred Taft) Newsgroups: comp.windows.x Subject: Re: XtDestroyWidget Message-ID: <100920021@hpcvlx.HP.COM> Date: 24 Oct 88 21:17:03 GMT Article-I.D.: hpcvlx.100920021 References: <1988Oct20.185736.11547@cs.rochester.edu> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 16 You need to understand that destroying a widget is really a two phase process. When you make your call to XtDestroyWidget(), the toolkit simply marks each of the widgets as 'being destroyed'; at this point, nothing has been deleted (widgets, windows, children, etc). The next time you make a call to XtNextEvent (directly or by means of XtMainLoop), the first thing it does is check to see if there are any widgets waiting to be destroyed. If there are, then it finishes destroying them; this includes removing and destroying their windows, freeing up any resources they had allocated, freeing up their widget structure, and updating their parent's children list. At that point, it should be safe for you to create a new child of the shell widget. You can probably force the second phase of the destroy to occur by pushing a bogus event on the event queue, and then making a call to XtNextEvent() directly; you can then discard the bogus event it will return to you.