What I'm seeing is that intermittently, cpSpaceIsLocked() is returning NO, but the app still crashes with a space->locked message because presumably the main thread has started chipmunk.update() just after the sound threads call to cpSpaceIsLocked(). The code being actioned by the sound completion block is basically executing code that indirectly triggers a dealloc which removes a sprite and it's associated body/shapes from the space.
Code: Select all
if (cpSpaceIsLocked(cpBodyGetSpace(self.body))) {
cpSpaceAddPostStepCallback(cpBodyGetSpace(self.body), punchPopFunc, @"punchPopFunc", self);
} else {
[self popForValue:0];
}