Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_ACCESS in NSTableView adding object when visible



Timothy Collett <mailto:email@hidden> wrote (Saturday, May 26, 2007 11:28 AM -0400):
Greetings. I am still pretty new at Cocoa, and I am experiencing a bad
access error in an NSTableView when adding an object to its data
source while the table is visible, or on the first time attempting to
show the NSTableView after adding the object.  According to the stack
view visible in the debugger window, the bad access occurs when trying
to set the value of the cell.  It makes me think I've not allocated or
retained something correctly, but I'm not sure what.

This is probably an over-released object. You should be able to verify this by turning on the NSZombie options (see <http://developer.apple.com/technotes/tn2004/tn2124.html>).


One thing to look out for with NSCell is that NSCell objects get copied constantly. They are "rubber stamps" used over and over again to draw the contents of rows, and whenever they are needed the table/outline classes make a copy of them. If you've subclassed NSCell make sure you are implementing all of the NSCopy protocols correctly. If you don't, you get two NSCells both referencing a single object with a single retain. Then one NSCell gets released and the second one blows up.

As I don't know of a way to get XCode to give me the stack trace in
textual form, I've taken a screenshot and posted it at
<http://homepage.mac.com/danaris/stacktrace.png>.

If you open up the console window for the debugger, you can chat directly with gdb. You can issue gdb commands to get back traces, dump variables, etc.


--
James Bucanek

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >EXC_BAD_ACCESS in NSTableView adding object when visible (From: Timothy Collett <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.