Article View: comp.sys.amiga.tech
Article #7992Shared IDCMP ports
From: Lamonte Koop
Date: Fri, 11 Jan 1991 02:56
Date: Fri, 11 Jan 1991 02:56
47 lines
2167 bytes
2167 bytes
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;
Ok...all's well, all of my messages are coming into the first window's
UserPort. I don't need to check the IDCMPWindow portion of my IntuiMessages,
due to the arrangement I have set up, but rather just ReplyMsg() to each
message I process as if it were from one window. 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.
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.
Technical Details
Message-ID:
<6841@crash.cts.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!nosc!crash!pnet01!lkoopShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!nosc!crash!pnet01!lkoop From: lkoop@pnet01.cts.com (Lamonte Koop) Newsgroups: comp.sys.amiga.tech Subject: Shared IDCMP ports Message-ID: <6841@crash.cts.com> Date: 11 Jan 91 02:56:07 GMT Sender: root@crash.cts.com Organization: People-Net [pnet01], El Cajon CA Lines: 47