🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #38056

Re: cleaning up from exit

#38056
From: Erik M. van der Poel
Date: Tue, 06 Mar 1990 11:07
58 lines
3215 bytes
> >I think that the application programmer should explicitly call
> >XtDestroyWidget() for widgets whose documentation clearly states that
> >destruction is necessary. 
> 
> Hopefully clean up procs would reduce the number of widgets for which
> this is necessary.

Even if you have clean-up procs or some other way for widgets to tell
Xt that they crave destruction, the author of such a widget should
probably warn app programmers that they should call XtExit() and not
exit(). But, yes, I agree that it would be better for us to migrate to
a situation where calling XtDestroyWidget() is unnecessary.

Of course, all this wouldn't be necessary if everyone had the ANSI C
atexit() (to register clean-up procs), but even then you can't protect
yourself against a programmer that suddenly and gleefully calls
execl(). (Well, not easily, anyway.) Or does ANSI C support that now
too? Perhaps it should.


> >As far as XtDestroyApplicationContext() is concerned, I think that it
> >should destroy all widgets associated with the app context. Otherwise,
> >XtWidgetToApplicationContext() would not be meaningful. Similarly,
> >XtCloseDisplay() should destroy all associated widgets.
> 
> Whether or not all these widgets want or need their destroy procedure
> called?  Wouldn't this be a waste of time?  The widget destroy proc was 
> envisioned to free up Pixmaps, GCs and things from X which would not 
> have to be freed explicitly if the connection to the X server were 
> closing.

I said that XtDestroyApplicationContext() should destroy all
associated widgets. I did *not* say that apps should call
XtDestroyApplicationContext(). Most apps should probably just call
exit() oops I mean XtExit().

As Paul said, destroy procs are really meant for applications that
wish to continue processing after destroying some widgets. Destroying
the app context is analogous to destroying widgets.

However, it probably is a waste of time to explicitly ask the X server
to free resources when they will be freed automatically and quickly
when the connection is closed. So XtCloseDisplay() should probably
tell the widgets not to bother freeing server resources.


> (Otherwise, wouldn't they have called all of the destroy procs in the
> current Intrinsics implementation?)

Even the X Consortium occasionally makes mistakes. But I hasten to add
that, on the whole, they have done and are doing a great job, and that
is why I am interested in the first place.
-
-- 
Erik M. van der Poel                  erik@sra.co.jp             (Japan)
Software Research Associates, Inc.    erik%sra.co.jp@uunet.uu.net  (USA)
Tokyo, Japan    TEL +81-3-234-2692    erik%sra.co.jp@mcsun.uucp (Europe)
Technical Details
Message-ID: <4138@srava.sra.co.jp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!ccut!titcca!ccut!wnoc-tyo-news!sragwa!sran124!srava!erik
References: <9003051636.AA07336@wilkins.bcm.tmc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!ccut!titcca!ccut!wnoc-tyo-news!sragwa!sran124!srava!erik
From: erik@srava.sra.co.jp (Erik M. van der Poel)
Newsgroups: comp.windows.x
Subject: Re: cleaning up from exit
Message-ID: <4138@srava.sra.co.jp>
Date: 6 Mar 90 11:07:12 GMT
References: <9003051636.AA07336@wilkins.bcm.tmc.edu>
Reply-To: erik@sra.co.jp (Erik M. van der Poel)
Organization: Software Research Associates, Inc., Japan
Lines: 58