[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Error with lists
From: |
David Aliaga |
Subject: |
Error with lists |
Date: |
Thu, 11 Jan 2001 03:08:46 -0800 (PST) |
Hello:
I got errors when running a simulation in which I am
using Lists. I think it must be simple but I can"t
figure it out. Could someone help me?
I have the following code:
-(int)method1
{ int numEnemy=0;
if(listOfSensations==nil) listOfSensations=[List
create:[self getZone]];
[listOfSensations deleteAll];//--> Sometimes it crash
here!!
// Other things here
anEnemy=[[Enemy create: [self getZone]] setX: xS
Y:yS];
[listOfSensations addLast: anEnemy];
numEnemy++;
// Other things --> Other times it crash here!
return(numEnemy)//--> Other here
}
-otherMethod
{int nsensa;
int i;
id enem;
nsensa=[self method1];
// Other stuff including a for(i=.....
enem=[listOfSensations atOffset: i];
// Other stuff
[listOfSensations deleteAll];
[listOfSensations drop];
return(accionEsc);
}
listOfSensations is a instance variable of type id.
Enemy is another object and listOfSensations is a List
of Enemy's .
The stranbe thing is I got segmentation fault,
sometimes in the deleteAll line and sometimes in other
parts, when I run gdb step by step everything goes
fine but it crash again if I let it run (with
continue)
Any idea?
I suspect that I am doing bad stuff with the pointers.
David
__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/
==================================
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.
- Error with lists,
David Aliaga <=