Re: The Cell from Hell (TM)
Re: The Cell from Hell (TM)
- Subject: Re: The Cell from Hell (TM)
- From: Jim Witte <email@hidden>
- Date: Fri, 7 May 2004 13:38:17 -0500
If you alloc-init-autorelease an NSCell and hand it to two
NSTableViews (with setDataCell or whatever), memory management is
taken care of properly.
Not quite (at least for NSTextFieldCells). The NSCell does not retain
the NSTableView (otherwise there would be a retain cycle and/or it is
shared), but nevertheless keeps a reference to it which you can
inspect [..] Now if last NSTableView goes away, the NSCell will die
trying to be displayed in the other NSTableView (or even copied).
But if you do hand an NSCell to two NSTableViews, which view is the
NSCell's reference to - or is it to both?
NSCells are indeed copyable, and apparently NSTableView do a lot of
copying when you edit the cell. However not everything survives a
copy -- I had some code that used copied NSCells to get around this
problem, and the placeholder strings were all missing. Moreover, if
you have a long menu, I suspect (but haven't confirmed) the menu gets
copied too, which is non-trivial.
This (copying the cells when editing - why would a simple edit need
to copy anyway?) would seem to be a drain on speed (of some magnitude),
especially with long menus (if poster is indeed correct on this one).
And not copying the *whole* cell (placeholder strings missing) sounds
like a bug to me.
Jim
_______________________________________________
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.