I was testing out my program on the iPhone and I get this error in the debugger. (It is fine on the simulator because you can't simulate multiple touches)
Assertion failed: (cpArrayContains(space->bodies, body)), function cpSpaceRemoveBody, file .../Chipmunk/src/cpSpace.c, line 318.
Program received signal: “SIGABRT”.
Seems to occur when I tap one finger down and then tap another down quickly. Program freezes and quits. I am using the cpMouse to handle input requests.
The error is with this function:
void cpSpaceRemoveBody(cpSpace *space, cpBody *body) {
assert(cpArrayContains(space->bodies, body));
cpArrayDeleteObj(space->bodies, body);
}
Does it have something to do with removing the pointers and adding them too quickly that they mess up? Any suggestions for a fix? I'm still playing around with it.
Assertion error with cpSpaceRemoveBody
-
- Posts: 12
- Joined: Thu Feb 04, 2010 12:34 pm
- Contact:
-
- Posts: 12
- Joined: Thu Feb 04, 2010 12:34 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
I am also using:
cocos2d-iphone v0.9.0-beta2
and the Chipmunk version that came with that. Does that have the newest version or was this bug fixed?
cocos2d-iphone v0.9.0-beta2
and the Chipmunk version that came with that. Does that have the newest version or was this bug fixed?
-
- Posts: 12
- Joined: Thu Feb 04, 2010 12:34 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
I believe (99% sure) I just added in the newest version of Chipmunk 5.1 and still get the error. However, the error is now:
Assertion failed: (cpArrayContains(space->bodies, body)), function cpSpaceRemoveBody, file .../Chipmunk/src/cpSpace.c, line 321.
Program received signal: “SIGABRT”.
(Changed the line number of the error)
Assertion failed: (cpArrayContains(space->bodies, body)), function cpSpaceRemoveBody, file .../Chipmunk/src/cpSpace.c, line 321.
Program received signal: “SIGABRT”.
(Changed the line number of the error)
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
The issue is that its attempting to remove a body from the space that was never added in the first place. I suppose that should be a warning really. It won't trigger a crash, it's just sort of like a double free error. I'll change that in trunk.
You can disable assert() statements by compiling your source with the -DNDEBUG flag. You should be doing this for release builds at least as some of the assertions can be fairly expensive. If you can't figure out why it's trying to remove a body that was never added, you can just disable the assertions the same way.
You can disable assert() statements by compiling your source with the -DNDEBUG flag. You should be doing this for release builds at least as some of the assertions can be fairly expensive. If you can't figure out why it's trying to remove a body that was never added, you can just disable the assertions the same way.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 12
- Joined: Thu Feb 04, 2010 12:34 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
How would you add the -DNDEBUG flag?
When I comment out that assert statement, I get the following error:
Program received signal: “EXC_BAD_ACCESS”.
When I comment out that assert statement, I get the following error:
Program received signal: “EXC_BAD_ACCESS”.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
Add it to the "other c flags" option in your target's build settings.
Like I said, that particular assert was more like a warning. It wouldn't lead to a crash unless something else way the problem. The debugger is you friend here.
Like I said, that particular assert was more like a warning. It wouldn't lead to a crash unless something else way the problem. The debugger is you friend here.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 12
- Joined: Thu Feb 04, 2010 12:34 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
Grabbed the latest version:
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Program received signal: “EXC_BAD_ACCESS”.
Much better on the errors! Still have the EXC_BAD_ACCESS, but I guess that is now on my end to figure out. Weird, I still have the problem, but now it is after 4 to 5 sets of taps before it crashes, not after the first set of taps like before. Weird.
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Chipmunk warning: Cannot remove a body that was never added to the space. (Removed twice maybe?)
Failed condition: cpArrayContains(space->bodies, body)
Source: ../Chipmunk/src/cpSpace.c:411
Program received signal: “EXC_BAD_ACCESS”.
Much better on the errors! Still have the EXC_BAD_ACCESS, but I guess that is now on my end to figure out. Weird, I still have the problem, but now it is after 4 to 5 sets of taps before it crashes, not after the first set of taps like before. Weird.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
Heh, well I didn't really change anything other than to turn a few of the hard asserts into warnings.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 12
- Joined: Thu Feb 04, 2010 12:34 pm
- Contact:
Re: Assertion error with cpSpaceRemoveBody
Well, I solved my problem. I am hitting myself for it. Technically it doesn't "solve it" but it makes it never occur.
[window setMultipleTouchEnabled:YES];
to:
[window setMultipleTouchEnabled:NO];
Haha. For some reason it does not like the multiple touches. Thanks for updating though, it actually did help me in another place find an error and improved my touch interface.
[window setMultipleTouchEnabled:YES];
to:
[window setMultipleTouchEnabled:NO];
Haha. For some reason it does not like the multiple touches. Thanks for updating though, it actually did help me in another place find an error and improved my touch interface.
Who is online
Users browsing this forum: No registered users and 19 guests