[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Assertion error with cpSpaceRemoveBody

Assertion error with cpSpaceRemoveBody

Official forum for the .

Assertion error with cpSpaceRemoveBody

Postby maz » Thu Feb 04, 2010 12:44 pm

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.
maz
 
Posts: 12
Joined: Thu Feb 04, 2010 12:34 pm

Re: Assertion error with cpSpaceRemoveBody

Postby maz » Thu Feb 04, 2010 1:00 pm

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?
maz
 
Posts: 12
Joined: Thu Feb 04, 2010 12:34 pm

Re: Assertion error with cpSpaceRemoveBody

Postby maz » Thu Feb 04, 2010 2:07 pm

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)
maz
 
Posts: 12
Joined: Thu Feb 04, 2010 12:34 pm

Re: Assertion error with cpSpaceRemoveBody

Postby slembcke » Thu Feb 04, 2010 2:14 pm

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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Assertion error with cpSpaceRemoveBody

Postby maz » Thu Feb 04, 2010 2:27 pm

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”.
maz
 
Posts: 12
Joined: Thu Feb 04, 2010 12:34 pm

Re: Assertion error with cpSpaceRemoveBody

Postby slembcke » Thu Feb 04, 2010 2:34 pm

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. ;)
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Assertion error with cpSpaceRemoveBody

Postby maz » Thu Feb 04, 2010 4:53 pm

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.
maz
 
Posts: 12
Joined: Thu Feb 04, 2010 12:34 pm

Re: Assertion error with cpSpaceRemoveBody

Postby slembcke » Fri Feb 05, 2010 9:24 am

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/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Assertion error with cpSpaceRemoveBody

Postby maz » Fri Feb 05, 2010 12:52 pm

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.
maz
 
Posts: 12
Joined: Thu Feb 04, 2010 12:34 pm


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest

cron