Re: NSOutlineView retaining/releasing data cell
Re: NSOutlineView retaining/releasing data cell
- Subject: Re: NSOutlineView retaining/releasing data cell
- From: Pete Yandell <email@hidden>
- Date: Fri, 28 May 2004 12:00:35 +1000
From memory, NSTableView and NSOutlineView tend to make duplicates of
the cells they use at weird times. Your cell needs to implement the
NSCopying protocol, or you'll run into trouble.
On 28/05/2004, at 1:48 AM, Darrin Cardani wrote:
I'm seeing something I don't understand. I have an NSOutlineView, and
I've subclassed NSTableColumn to create a custom column so I can put
different types of data cells in it for each row. One of the cells is
a custom cell I've implemented myself, and it creates an NSArray of
NSImages when it is initialized. However, the custom NSCell's dealloc
method is getting called too soon, and I can't figure out why.
I've overridden the custom NSCell's retain and release methods to see
what's happening, and it looks like NSOutlineView is doing an extra
release at the end of its mouseDown: method. (Or rather, NSTableView's
mouseDown: method. According to the stack trace NSOutlineView calls
NSTableView's mouseDown: method at some point and that's the one doing
the apparent extra release.)
When I first create the cell, I retain it. When the NSTableColumn is
deallocated, then I release the cell. Other than that, I'm not
retaining or releasing the cell at all. It seems like NSOutlineView
should be retaining the cell one extra time before it starts its
mouseDown functionality. But clearly if it were a bug in
NSOutlineView, I wouldn't be the only one seeing the problem. :-) So
what am I missing? Where else do I need to be retaining the cell?
Thanks,
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.