• 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
NSCopyObject is a disaster (was Re: Another NSOutlineView issue)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSCopyObject is a disaster (was Re: Another NSOutlineView issue)


  • Subject: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)
  • From: Graham Cox <email@hidden>
  • Date: Thu, 09 Aug 2012 09:21:23 +1000

On 09/08/2012, at 9:10 AM, Graham Cox <email@hidden> wrote:

> Ah, I'm thinking this *could* be due to my previous observation about cells being copied using NSCopyObject. If the cells are copied during that animation for some reason, then perhaps the text settings for my custom cell are not being copied, since I'm alloc/initing a new cell in copyWithZone: instead of relying on super's implementation. I'll follow along with that line of thought....


Yep, that seems to be the issue.

This opens up a whole big can of worms about implementing copy.

If a superclass implements copies using NSCopyObject, then any pointer ivars we add in a subclass need to be additionally -retained. But if the superclass implements copy by alloc/initing a new object and setting properties, then this extra step would lead to an over-retain and so leak.

But how can we know what approach the superclass has taken? It's not documented and we don't have the source. Aren't we supposed to be immune from implementation details like this? Or is it just a case of after a while the experienced Cocoaista "just knows" what to do in each case? This is only just rearing its head for me after almost 10 years...

--Graham



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)
      • From: Uli Kusterer <email@hidden>
    • Re: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)
      • From: Quincey Morris <email@hidden>
    • Re: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)
      • From: Greg Parker <email@hidden>
References: 
 >Another NSOutlineView issue (From: Graham Cox <email@hidden>)

  • Prev by Date: Another NSOutlineView issue
  • Next by Date: Re: +underPageBackgroundColor
  • Previous by thread: Another NSOutlineView issue
  • Next by thread: Re: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)
  • Index(es):
    • Date
    • Thread