• 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: NSTableView crash when selected.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView crash when selected.


  • Subject: Re: NSTableView crash when selected.
  • From: Andy Lee <email@hidden>
  • Date: Tue, 17 Feb 2009 13:21:55 -0500

On Feb 17, 2009, at 12:51 PM, Harry Plate wrote:
Eg, I created an NSString, added it to an NSArray, then created an
NSAttributedString for each array element. So what would the retention count
be? 2 or 3?

You don't know and it doesn't matter. Don't think in terms of retain counts. Think about whether you "own" an object, i.e., whether you are responsible for releasing it.


<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/20000043-BEHDEDDB >

So when I 'release' an NSArray, can I count on NSArry to release all of its
elements?

When you have a question about a class or method, the first place to look is the docs. See the docs for NSArray, especially the "Overview" section, especially the paragraph that begins "Arrays maintain strong references to their contents..."


Likewise for NSTableView?

An NSTableView doesn't have elements. It gets its contents from either a data source or a binding.


Seems like that would be a valid
assumption. Eg, when we did our leak test we concluded we had to [array
removeAllObject] before we [array release]. This just doesn't seem right...

It isn't. :)

--Andy


_______________________________________________

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


References: 
 >Re: NSTableView crash when selected. (From: Harry Plate <email@hidden>)

  • Prev by Date: Re: serialPortSample... hang on "read" function
  • Next by Date: What is a CALayer?
  • Previous by thread: Re: NSTableView crash when selected.
  • Next by thread: Re: NSTableView crash when selected.
  • Index(es):
    • Date
    • Thread