• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why does this leak memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: RE: Why does this leak memory?
  • Next by Date: RE: Why does this leak memory?
  • Previous by thread: Re: Why does this leak memory?
  • Next by thread: RE: Why does this leak memory?
  • Index(es):
    • Date
    • Thread