I'm trying to debug some code. I ran the static analyzer, and thought I fixed a memory leak, and now I get an error when I switch between two tabs. Here is my code when I switch between the 2nd tab and first tab:
if (_sortButton != nil) {
self.SortButton = nil;
NSMutableArray *barItems = [[self.MainToolbar items] mutableCopy];
[barItems removeObjectAtIndex:0];
[self.MainToolbar setItems:barItems]; // bad access here
[barItems release];
}
I keep getting the EXC_BAD_ACCESS on the self.MainToolbar setItems line. I added the NSZombieEnabled as an environment variable, set a break point at that bad access line, but I do not get anything printed to the console when either stepping after the breakpoint, hitting continue after the breakpoint, etc. Am I using this correctly? Thanks.
Far easier to use than NSZombieEnabled, is to use Profile
instead when running and select the NSZombie instrument.
This requires XCode4.