🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Shared IDCMP ports

#7996
From: Brian Jackson
Date: Fri, 11 Jan 1991 09:36
49 lines
2191 bytes
In article <6841@crash.cts.com> lkoop@pnet01.cts.com (Lamonte Koop) writes:
>
>I'm having a problem utilizing a shared IDCMP port setup on a window
>arrangement, and wonder if anyone can see a problem with what I'm doing.
> [...] 
>Now, the problem comes when I try to close the second window.  NOw, 
>I realize you cannot simply do this normally, so I use the following
>routine:
> 
>void SafeClose(swin)
>struct Window *swin;
>{
>    struct IntuiMessage *msg;
>    struct IntuiMessage *succ;
>    struct MsgPort      *mp = (struct MsgPort *)swin->UserPort;
> 
>    Forbid();
>    msg = (struct IntuiMessage *)mp->mp_MsgList.lh_Head;
>    while(succ=(struct IntuiMessage *)msg->ExecMessage.mn_Node.ln_Succ) {
>        if (msg->IDCMPWindow == swin) {
>           Remove(msg);
>           ReplyMsg(msg);
>        }
>        msg = succ;
>    }
>    swin->UserPort = NULL;
>    Permit();
>    CloseWindow(swin);
>}
>
>Generally, calling this results in a corrupt memory list guru. Now, anyone
>have a suggestion?  I realize this is an old topic, but I cannot find
>referernces to it presently.  
>

Try adding 

     ModifyIDCMP(swin,0L);

between the Permit() and the CloseWindow() calls. It's the only
difference between yours and the one that I have (that works.)

bj

 -----------------------------------------------------------------------
 | Brian Jackson  Software Engineer, Commodore-Amiga Inc.  GEnie: B.J. |
 | bj@cbmvax.cbm.commodore.com    or  ...{uunet|rutgers}!cbmvax!bj     |
 | "My beer comes from farther away than your beer."                   |
 -----------------------------------------------------------------------
Technical Details
Message-ID: <17379@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!julius.cs.uiuc.edu!wuarchive!emory!gatech!rutgers!cbmvax!bj
References: <6841@crash.cts.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!julius.cs.uiuc.edu!wuarchive!emory!gatech!rutgers!cbmvax!bj
From: bj@cbmvax.commodore.com (Brian Jackson)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Shared IDCMP ports
Message-ID: <17379@cbmvax.commodore.com>
Date: 11 Jan 91 09:36:56 GMT
References: <6841@crash.cts.com>
Reply-To: bj@cbmvax.commodore.com (Brian Jackson)
Organization: Commodore, West Chester, PA
Lines: 49