Re: NSOutlineView: expanding an item retains it?
Re: NSOutlineView: expanding an item retains it?
- Subject: Re: NSOutlineView: expanding an item retains it?
- From: j o a r <email@hidden>
- Date: Sat, 22 Jan 2005 15:44:44 +0100
On 2005-01-22, at 06.44, Steve Mykytyn wrote:
While dealing with a knotty retain problem in an NSDocument-based app
I noticed that NSOutlineView appears to retain any expanded items.
This retain is not mentioned in the docs AFAIK, and I would not have
noticed had I not introduced a very subtle bug of my own that caused
me to look closely at the dealloc sequencing using MallocDebug.
Should it be this way?
<snip>
Although this SEEMS harmless, I wonder. Everything runs OK now in my
app even if it gets dealloc a little late.
You're looking at what is probably considered an implementation detail
of NSOutlineView. You should only concern yourself with things like
this if if negatively affects your ability to use a component - and it
doesn't appear to be the case for you as it is.
Objects passed around by Cocoa classes are routinely retained /
released / autoreleased. As long as the balance is maintained (a
release / autorelease for every retain) you needn't / shouldn't concern
yourself with this.
On 2005-01-22, at 15.29, Clark Cox wrote:
When an NSOutlineView has an expanded item, it needs to hold onto that
item so that it can come back and ask you for its sub-items. If it
didn't retain it, then how could it reliably do that?
By asking the data source for the items? To me retaining implies
ownership - and I don't think that an outline view should be considered
the owner of the tree of objects that it represents. I haven't given
this a whole lot of thought, so I could be wrong.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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