[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/bbcode.php on line 112: 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 112: 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 - Problem removing object in Object chipmunk 5.3.3

Problem removing object in Object chipmunk 5.3.3

Discuss any Chipmunk bugs here.

Problem removing object in Object chipmunk 5.3.3

Postby ganesha » Fri Dec 10, 2010 2:25 pm

ganesha
 
Posts: 71
Joined: Mon Sep 06, 2010 1:29 pm

Re: Problem removing object in Object chipmunk 5.3.3

Postby ganesha » Fri Dec 10, 2010 3:48 pm

ganesha
 
Posts: 71
Joined: Mon Sep 06, 2010 1:29 pm

Re: Problem removing object in Object chipmunk 5.3.3

Postby slembcke » Fri Dec 10, 2010 8:09 pm

Can you double check that? cpSpace.c line 305 is the space lock assertion from cpSpaceAddShape(). If you run it from the debugger it should show you a stack trace of where the assertion was triggered.

I made some of the assertions more strict after finding a couple of new ways to cause crashes from queries and cpBodyActivate().
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: Problem removing object in Object chipmunk 5.3.3

Postby ganesha » Sat Dec 11, 2010 5:53 am

I have checked the code. The problem occurs when hitting the [space step] function the first time after calling addPostStepCallback. The app crashes without any stack trace.

The earlier log was from my attempt to skip the addPostStepCallback function (due to this error) and thus triggering the assert error. My post was a little bit unclear about this.

Order of execution:

1.[space step...] Executing fine in run loop
2.[self.space addPostStepCallback:self selector:@selector(addObjectToSpace:) context:object];
3.[space step...] crash

Method addObjectToSpace is never called.

Note: if the objects are added before the loop starts the [space add...] method works fine.
ganesha
 
Posts: 71
Joined: Mon Sep 06, 2010 1:29 pm

Re: Problem removing object in Object chipmunk 5.3.3

Postby slembcke » Sat Dec 11, 2010 12:27 pm

Are you calling addPostStepCallback: outside of step:?
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: Problem removing object in Object chipmunk 5.3.3

Postby ganesha » Sat Dec 11, 2010 1:00 pm

Both during step and outside. Both fail. Is this approach wrong?
ganesha
 
Posts: 71
Joined: Mon Sep 06, 2010 1:29 pm

Re: Problem removing object in Object chipmunk 5.3.3

Postby slembcke » Sat Dec 11, 2010 3:16 pm

I ask because just a couple days ago I noticed 2 minor bugs in addPostStepCallback. Then yesterday I got the first two bug reports for it. /me facepalm Talk about unfortunate timing.

The first bug was that it was using the target instead of the context as the key value for the underlying call to cpPostStepCallback() which meant that you could only register once callback per target. The documentation also needed to be updated to make it more clear that this was happening too. The other bug is the one that you've hit. While you can call addPostStepCallback: from outside of step:, it wasn't really intended to done. If you aren't in a collision callback, there really is no need to use a post-step callback as their purpose is to allow you to defer removals from a collision callback until it's safe to do so. addPostStepCallback: didn't actually retain it's arguments, and nobody noticed until now. I only stumbled upon the issue by chance.

It's not really possible to fix the old method without breaking existing working code, so I've marked it as deprecated and written a new method:
- (void)addPostStepCallback:(id)target selector:(SEL)selector key:(id)key;

The new name reflects that the context value is actually a key, and I made sure the documentation is crystal clear this time about how it works. I also created some extra C APIs in Chipmunk to support managing the post-step callback memory, so now it doesn't make assumptions about the memory management. Lastly, I've written unit tests to cover it. Bugs begone!

I'm pushing to make sure I have all the new tests written by tomorrow or Monday so that I can send out the 5.3.4 update, but I can send you a dev build now if you want. What email did you use to purchase Objective-Chipmunk?
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: Problem removing object in Object chipmunk 5.3.3

Postby ganesha » Sat Dec 11, 2010 4:33 pm

See PM.
ganesha
 
Posts: 71
Joined: Mon Sep 06, 2010 1:29 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron