I seem to be dealloc'ing something like the tab bar itself, navigation controller, or ???, and this happens when I go to a particular view controller and then hit the tab bar to a specific tab (eg, if I hit the middle tab, of 3 tabs, no problem, but if I hit the rightmost tab I get the crash). My program is basically complete and I have a pretty big code base at this point. Anyone have any suggestions for debugging this -- I've been waiting until now to work on this. My sense, is to look at the dealloc routines and any releases in the neighboring code. Any thing less 'manual' you can suggest? Thanks!
views:
490answers:
1Without knowing more, here's how I would go about it.
In the log viewer, type backtrace after the exception occurs in gdb. Hopefully, this will give you the exact line that shows which object is being free'd too many times.
Look for references to this object and see if you can find the unnecessary release, autorelease, etc. by inspection. You are not to release/autorelease anything that your execution path does not own (via alloc).
You may have some luck printing out retain counts for this object (by sending the retainCount message to the offending object). Though the developer's documentation strongly suggests that this is meaningless and not fruitful, I've found it useful on occasion to help me narrow down when I've freed something by accident.