NSTableView copies cells - bug or feature?
NSTableView copies cells - bug or feature?
- Subject: NSTableView copies cells - bug or feature?
- From: Brian Webster <email@hidden>
- Date: Thu, 6 Jun 2002 14:06:21 -0500
I've been working with an NSTableView that display its rows
using a custom subclass of NSCell that I wrote. The cell has an
instance variable where it holds an object that it uses for its
drawing. My table view's delegate sets this object through a
setter in the tableView:willDisplayCell:... method.
I was having troubles with this setup where my app would crash
as soon as I selected a row. After much banging my head against
the wall, I discovered that one of the objects held by my cell
was being released one too many times. After a couple more
hours of banging, I finally discovered that my cell (set using
-[NSTableColumn setDataCell:]) was being copied by the table
view to display the selected row. Since I didn't implement
NSCopying on my cell, it did a shallow copy of the instance
variables, which of course leads to a release with no
corresponding retain.
This behavior does not seem to be documented anywhere in NSCell,
NSTableView, or NSTableColumn. The strangest thing is that the
copy only happens if I select a row via a mouse click; it does
not happen if you select rows using the arrow keys. So, before
I file a bug report on this, I wanted to see if anyone had
encountered this before, or if it is actually documented
somewhere that I missed.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.