Re: Why does this leak memory?
Re: Why does this leak memory?
- Subject: Re: Why does this leak memory?
- From: Matt Ball <email@hidden>
- Date: Mon, 11 Jul 2005 21:22:02 -0400
I've tried that (and changed my code back to it just now), and that
results in the same crash whenever I click on a row...
- Matt Ball
On 7/11/05, Jeff Laing <email@hidden> wrote:
> > That's what I figured... This code should be correct, right? With it
> > in place, I still get strange nscell editing behavior...
> >
> > - (id)copyWithZone:(NSZone *)zone
> > {
> > LayerCell *copy = [[[self class] alloc] init];
> > [copy setImage:[self image]];
> > [super copyWithZone:zone];
> > return copy;
> > }
> >
> > It seems like it might have something to do with the fact that I can't
> > pass "copy" to [super copyWithZone:zone]; Then again, I could be way
> > off...
>
> No, thats the problem. It should be something like:
>
> - (id)copyWithZone:(NSZone *)zone
> {
> LayerCell *copy = [super copyWithZone:zone];
> [copy setImage:[self image]];
> return copy;
> }
>
> ie, get the superclass to make a copy first, then do the additional stuff
> that your subclass needs to do to the copy before returning it.
>
> Note also, this is assuming that you setImage: retains the image its passed
> in, and I'm not 100% sure on whether you need to be copying the image, or
> making another reference to the same one. I'm not an expert on this
> either...
>
_______________________________________________
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