Path: 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 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