Re: newbie EXC_BAD_ACCESS
Re: newbie EXC_BAD_ACCESS
- Subject: Re: newbie EXC_BAD_ACCESS
- From: Hamish Allan <email@hidden>
- Date: Tue, 22 Mar 2005 02:48:56 +0000
On Mar 22, 2005, at 1:02, Charilaos Skiadas wrote:
I would think that [self addStrokeDesc: sd] would presumably add sd to
some array where all those stroke descriptions are kept, hence sd
would be retained there, hence can safely be released here, since this
is the last line in the code anyway, and this method does not return
sd anyway.
True, but I was also trying to imagine why he was getting the behaviour
he described when he said "the knownStrokes array was getting the last
copy of sd created placed in every single slot of the array." If he
wasn't retaining sd in addStrokeDesc: then he would get that behaviour
with release but not with autorelease (because the next allocated
StrokeDescription would have the same pointer as the previous one). I
wanted him to try to explain why, so I didn't go further into it. As it
turns out, he is retaining sd in addStrokeDesc: so my assumption was
incorrect (sorry!)
I don't quite see the need for the autorelease here. He is trying to
do without the class method strokeDescriptionWithType you described
(btw, I think he *should* use the class method), so it seems to me
that, while in the class method the autorelease is necessary, here it
isn't.
No, you're quite right, and so is Daniel.
Best wishes,
Hamish
_______________________________________________
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