🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.amiga.tech
4 messages
4 total messages Started by Lamonte Koop Fri, 11 Jan 1991 02:56
Shared IDCMP ports
#7992
Author: Lamonte Koop
Date: Fri, 11 Jan 1991 02:56
47 lines
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.
Re: Shared IDCMP ports
#7996
Author: 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."                   |
 -----------------------------------------------------------------------
Re: Shared IDCMP ports
#8004
Author: Brian Jackson
Date: Fri, 11 Jan 1991 18:37
37 lines
1911 bytes
 ** Error Correction **

In article <17379@cbmvax.commodore.com> bj@cbmvax.commodore.com (Brian Jackson) writes:
>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:
>> 
   [ some example code deleted ] 

>>    swin->UserPort = NULL;
>>    Permit();
>>    CloseWindow(swin);
>>}
>
>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
 
Argh!!  Try adding it BEFORE the Permit() call!  My mistake (the excuse is
my staying up all night playing with computers).  Thanks to Peter!!

 -----------------------------------------------------------------------
 | Brian Jackson  Software Engineer, Commodore-Amiga Inc.  GEnie: B.J. |
 | bj@cbmvax.cbm.commodore.com    or  ...{uunet|rutgers}!cbmvax!bj     |
 | "It can be done." != "It should be done."                           |
 -----------------------------------------------------------------------
Re: Shared IDCMP ports
#8005
Author: William S Chou
Date: Fri, 11 Jan 1991 19:11
54 lines
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
___________________________________________________________________________
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads