Article View: comp.sys.amiga.tech
Article #8005Re: Shared IDCMP ports
From: William S Chou
Date: Fri, 11 Jan 1991 19:11
Date: Fri, 11 Jan 1991 19:11
54 lines
2793 bytes
2793 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.
>I have one main window, and a second window is opened, after which I make
>the following assignment;
>
>secondwin->UserPort = firstwindow->UserPort;
This is besides the point in question but aren't you wasting
memory here? Your UserPort is unlinked here and you haven't bothered
to restore it when you close the window. (from the Code below)
Assuming Intuition allocates UserPort rather than just give you a
pointer to an existing port.
>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.
>
>
> LaMonte Koop
> Internet: lkoop@pnet01.cts.com ARPA: crash!pnet01!lkoop@nosc.mil
> UUCP: {hplabs!hp-sdd ucsd nosc}!crash!pnet01!lkoop
> A scientist is one who finds interest in the kinetic energy of Jell-O
> moving at ridiculous velocities...an engineer is one who can find a
> real-life application for such silliness.
___________________________________________________________________________
// "Be Excellent to Eachother" - Bill & Ted
\\ // "And Most of All Be Excellent to Your Amiga"
\X/ - Will wsc1@cunixb.columbia.edu
___________________________________________________________________________
Technical Details
Message-ID:
<1991Jan11.191129.8718@cunixf.cc.columbia.edu>Path:
arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cunixf.cc.columbia.edu!cunixb.cc.columbia.edu!wsc1References:
<6841@crash.cts.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cunixf.cc.columbia.edu!cunixb.cc.columbia.edu!wsc1 From: wsc1@cunixb.cc.columbia.edu (William S Chou) Newsgroups: comp.sys.amiga.tech Subject: Re: Shared IDCMP ports Summary: Aren't you wasting memory? Message-ID: <1991Jan11.191129.8718@cunixf.cc.columbia.edu> Date: 11 Jan 91 19:11:29 GMT References: <6841@crash.cts.com> Sender: news@cunixf.cc.columbia.edu (The Daily News) Organization: Columbia University Lines: 54