Reputation: 5616
I have a modal view controller which is crashing when it dismisses itself. The error is EXC_BAD_ACCESS (yipee). I am tryin got use NSZombie to work out the problem. I get am getting the following :
2010-10-20 17:15:58.936 [24058:207] AddRunningClient starting device on non-zero client count 2010-10-20 17:16:06.846 [24058:207] * -[ViewController retain]: message sent to deallocated instance 0x6c2d4a0
What does this mean - does it mean that a message was sent to the Viewcontroller or that a message was sent to an object in the Viewcontroller ?
I am really stuck as the thread seems to be main :(
Thanks all in advance for any help,
Martin
EDIT
Thanks all for the quick replies. Here is how I am presenting the view controller :
-(IBAction)letsstartGame {
ViewController * sl = [[ViewController alloc] initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]];
self.viewLink = sl;
[sl release];
[mainMenu stop];
[mainMenu setCurrentTime:0.0];
[self presentModalViewController:viewLink animated:NO];
[viewLink release];
self.viewLink = nil;
}
And dismiss like this :
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (waitingOver) {
[backgroundMain stop];
[fireworks stop];
[self dismissModalViewControllerAnimated:NO];
}
}
Upvotes: 0
Views: 172
Reputation: 243156
That means that you had an instance of an object of type ViewController
, it was deallocated, and then you tried to retain
it.
edit
You're over-releasing the object. Here's what you're doing:
ViewController * sl = [[ViewController alloc] initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]]; //allocated, has a +1 retain count
self.viewLink = sl; //assuming a retain property, has a +2 retain count
[sl release]; //releasing, now has +1 retain count
....
[viewLink release]; //releasing, now has a 0 retain count
self.viewLink = nil; //attempting to release stale pointer, will result in a crash (perhaps not immediately, but eventually)
Get rid of the [viewLink release]
line. It is wrong to have that in there.
Upvotes: 2
Reputation: 4428
The message is basically saying that you are trying to send a message (call a function) on/to an object that has already been dealloc'd (released and the memory freed). If you could send more code, I could perhaps attempt to determine why.
Upvotes: 1
Reputation: 18717
It means you are sending a message to a deallocated instance. So somewhere in your code you have failed to retain an object (probably ViewController) or have released it prematurely.
If you can post your code where you create the View Controller that might be helpful for us to debug.
Upvotes: 1