swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation Fault in Creating NodeItems


From: Paul E. Johnson
Subject: Re: Segmentation Fault in Creating NodeItems
Date: Wed, 15 Sep 1999 08:15:23 -0500

Darren Schreiber wrote:
> 
> <x-rich>
> 
> When I build the Agent in the modelSwarm, I am having the Agent create a
> node for them on the canvas.  Using the following code:
> 
> -setNode: (id) aCanvas {
> 
>   agentNode = [OvalNodeItem createBegin: [self getZone]];
> 
>   [agentNode setCanvas: aCanvas];
> 
>   [agentNode setX: 50 Y: 50];
> 
>   [agentNode setString: (const char*) agentID];
> 
>   //[agentNode setTargetID: self];
> 
>   agentNode=[agentNode createEnd];
> 
>   return self;
> 
> }
> 
> It compiles fine, but I get the following error:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 
> 0x41e53d in _i_NodeItem__createPaddedText (self=0x4964188, _cmd=0x4b91e8)
> 
>     at /src/Swarm/swarm/src/tkobjc/NodeItem.m:150
> 
> /src/Swarm/swarm/src/tkobjc/NodeItem.m:150: No such file or directory.
> 
> (gdb)
> 
> When I step through the problem using a break, the segmentation fault
> occurs at the line agentNode=[agentNode createEnd];

I think the problem is that you have some methods from the "using"
section inside your createBegin/End brackets.

Only commands that show in the docs in the creating phase can go between
those two.  Absolutely for certain you don't want setX:Y:, setString: in
there.  

Move those after createEnd and I bet it works OK

-- 
Paul E. Johnson                         email: address@hidden
Dept. of Political Science              http://lark.cc.ukans.edu/~pauljohn
University of Kansas                    Office: (785) 864-9086
Lawrence, Kansas 66045                  FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]