[IPHONE] [CALayer retainCount]: message sent to deallocated instance
I'm getting the '[CALayer retainCount]: message sent to deallocated instance' message when pushing a viewcontroller on the navigation controller.
I have a FoodDirectoryController , which displays a number of food groups , which when selected push another child FoodDirectoryController on the navigationcontroller with the foods in that group. I select a food group , select back , select another food group and then it crashes.
This is the selection code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(self.currentGroup == -1)
{
NSInteger group = indexPath.row + rowOffset;
FoodEntryDirectory* controller = [ViewControllerFactory newFoodEntryDirectoryController]; //autoreleases
self.childFoodEntryDirectory = controller;
self.childFoodEntryDirectory.delegate = self.delegate;
self.childFoodEntryDirectory.currentGroup = group;
[self.navigationController pushViewController:self.childFoodEntryDirectory animated:YES];
}
else
{
//select a food
}
}
This is the malloc stack for the instance:
Call [2] [arg=48]: thread_a067ffa0 |0x1 | start | main | UIApplicationMain | -[UIApplication _run] | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | PurpleEventTimerCallBack | SendEvent | _UIApplicationHandleEvent | -[UIApplication sendEvent:] | -[UIWindow sendEvent:] | -[UITableView touchesEnded:withEvent:] | -[UITableView(_UITableViewPrivate) _sendSelectionDidChange] | -[FoodEntryDirectory tableView:didSelectRowAtIndexPath:] | -[UINavigationController pushViewController:animated:] | -[UINavigationController pushViewController:transition:forceImmediate:] | -[UINavigationController _startTransition:fromViewController:toViewController:] | -[UIViewController(UIViewControllerContentScrollView) contentScrollView] | -[UIViewController view] | -[UIViewController loadView] | -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:] | -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:] | _decodeObject | _decodeObjectBinary | -[NSArray(NSArray) initWithCoder:] | -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] | _decodeObjectBinary | -[UIRuntimeConnection initWithCoder:] | _decodeObject | _decodeObjectBinary | -[UITableView initWithCoder:] | -[UIScrollView initWithCoder:] | -[UIView initWithCoder:] | UIViewCommonInitWithFrame | -[UIView _createLayerWithFrame:] | +[NSObject alloc] | +[NSObject allocWithZone:] | internal_classcreateInstance | internal_classcreateInstanceFromZone | calloc | malloc zonecalloc
Have been racking my brains for hours now. Help would be very appreciated!
Thanks
MacBook Pro 2.2, Mac OS X (10.4.11)