🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #11213

CloseWindowSafely() ???

#11213
From: Ross Cunniff
Date: Fri, 27 Jan 1989 16:26
36 lines
1478 bytes
Regarding the AmigaMail function CloseWindowSafely() (which I
can't seem to find anywhere (hint,hint)), I have come up with
something that seems to work for windows which are sharing IDCMPs:

	ILock = LockIBase( 0 );

		while( Msg = GetMsg( Win->UserPort ) ) {
		    ReplyMsg( Msg );
		}
		Win->UserPort = NULL;
		CloseWindow( Win );

	UnlockIBase( ILock );

My questions about this are:

	1. Will this guarantee no GURUs?  (The code without the
	   LockIBase and the while( Msg = Getmsg() ) will GURU
	   if there are any pending messages to Win)

	2. Is it desirable to have the CloseWindow inside the
	   LockIBase()/UnlockIBase() protected region?  It seems
	   to work and has caused no problems, but it makes me
	   nervous to call Intuition functions inside the
	   protected region.  On the other hand, there may
	   be a window (pun intended) of vulnerability if the
	   UnlockIBase() is placed BEFORE the CloseWindow().

	3. There is no 3.

Answers, anybody?

					Ross Cunniff
					Hewlett-Packard Colorado Languages Lab
					...{ucbvax,hplabs}!hpfcrt!cunniff
					cunniff%hpfcrt@hplabs.ARPA
Technical Details
Message-ID: <11640008@hpfcdc.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!ucbvax!hplabs!hpfcdc!cunniff

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!ucbvax!hplabs!hpfcdc!cunniff
From: cunniff@hpfcdc.HP.COM (Ross Cunniff)
Newsgroups: comp.sys.amiga.tech
Subject: CloseWindowSafely() ???
Message-ID: <11640008@hpfcdc.HP.COM>
Date: 27 Jan 89 16:26:57 GMT
Organization: HP Ft. Collins, Co.
Lines: 36