Re: NSTableView crash when selected.
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