Re: -[NSSet initWithSet:copyItems:] crashing
Re: -[NSSet initWithSet:copyItems:] crashing
- Subject: Re: -[NSSet initWithSet:copyItems:] crashing
- From: Thomas Deniau <email@hidden>
- Date: Sat, 5 Mar 2005 18:33:15 +0100
Le 5 mars 05, à 18:16, j o a r a écrit :
Why did you comment out the interesting line in the code snippet?
I thought it was uninteresting :-) It's just an alloc/init...
HXCell *c=[[HXCell alloc]
initWithX:(int)catalog[type][orientation][i].x+[center x]
y:(int)catalog[type][orientation][i].y+[center y]];
[ms addObject:c];
[c release];
Also, could you attach the parts of the HXCell class that would be of
interest from a memory management perspective (the class interface and
the init, dealloc, retain, hash, copy, et.c. methods).
Here you go :
HXCell has two instances variables, x and y (two integers - I don't use
a struct because it's time-consuming to always switch between a struct
and a NSValue)
-(HXCell *)copyWithZone:(NSZone *)z
{
return [[HXCell allocWithZone:z] initWithX:x y:y];
}
-(BOOL)isEqual:(HXCell *)c
{
return (([c x] == x) && ([c y] == y));
}
-(unsigned)hash
{
return (unsigned)x;
}
-(HXCell *)initWithX:(int)aX y:(int)aY;
{
if (self = [super init])
{
x=aX;
y=aY;
}
return self;
}
+(HXCell *)cellWithX:(int)aX y:(int)aY;
{
return [[[self alloc] initWithX:aX y:aY] autorelease];
}
Thank you !!
--
Thomas Deniau
And wandering in path and mind / he groped as one gone sudden blind,
who seeks to grasp the hidden light / with faltering hands in more than
night.
(The Lay of Leithian, Canto IV)Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden