views:

73

answers:

1

Xcode is throwing an error at me:

malloc: * error for object 0x103f000: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug

I tracked down the code until a line where I do this:

- (void)inputValueCommitted:(NSString *)animationID finished:(BOOL)finished context:(void *)context {
        // retainCount of myView is 2! (one for the retain-property, one for beeing a subview)
        [self.myView removeFromSuperview]; // ERROR-LINE !!
        self.myView = nil;
}

When I remove that errorful line, the error is gone. So in conclusion: I can't get rid of my view!

It's an UIImageView with nothing else inside, just showing an image. What I do is this: I create an UIView Animation Block, create that UIImageView, assign it to an retain-property with self.myView = ..., and after the animation is done, I just want to get rid of that view. So I remove it from it's superview and then set my property to nil, which lets it go away - in theory.

Did anyone else encounter such issues? iPhone SDK 3.0.

+1  A: 

There a bug in Simulator in SDK 3.0 that can cause that error:

http://stackoverflow.com/questions/1424210/iphone-development-pointer-being-freed-was-not-allocated

It doesn't occur in Simulator in 3.1+, or on the device under any SDK version.

Tom