[SOLVED] Odd physics crash that isn't collioson based...

I’m encountering an odd crash that is very reproducible.

First the peculiar’s:

It’s a Storyboard App
I’m using Physics for collision detection (gravity at 0,0 since I don’t want gravity)
I’m using touch-drag to move my player through the game space.

If I do the following:

Move the player.
Press the Pause button.
Resume the game.
Move the player.

I get the following crash:

Crashed Thread: 0 Dispatch queue: com.apple.main-thread  
  
Exception Type: EXC\_BAD\_ACCESS (SIGSEGV)  
Exception Codes: KERN\_INVALID\_ADDRESS at 0x00000000da00925e  
  
VM Regions Near 0xda00925e:  
 CG backing stores 00000000c8fd7000-00000000c96b7000 [7040K] rw-/rw- SM=SHM   
--\>   
 Submap 00000000ffff0000-00000000ffff2000 r-x/r-x process-only submap  
  
Application Specific Information:  
objc[1596]: garbage collection is OFF  
  
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread  
0 org.Box2D.Box2D 0x001bb2f7 b2Body::SetTransform(b2Vec2 const&, float) + 21  

It should be noted that no collisions are involved. I do a physics.start() on storyboard.enterScene, I do a physics.stop() on storyboard.exitScene.

So the whole “don’t modify your object during a collision” bug/limitation isn’t the problem here.

Any ideas on this one?

Thanks
Rob
Now to go find my other crashing bug…

EDIT: Oh, happening with 764 and the last Stable build. [import]uid: 19626 topic_id: 23150 reply_id: 323150[/import]

http://s363.codeinspot.com/q/2140586

That is all i could find based on the info provided.

Are you removing any bodies when this happens ? [import]uid: 84637 topic_id: 23150 reply_id: 92645[/import]

I’m not removing anything during this crash. I move my player via touch-drag. I stop, I hit my pause button which switches screens, I hit the resume button to go back. I touch the player to start moving it and it crashes.

Maybe I should but a sleep on my gotoScene call to give the physics engine time to calm down.

EDIT: Didn’t seem to help. I’ll see if I can build a test case.
[import]uid: 19626 topic_id: 23150 reply_id: 92669[/import]

I had random crashes caused by calling physics.stop() if ALL the objects in the physics sim weren’t removed first. If I remember correctly the crash would happen upon calling physics.start again after an incomplete cleanup. And it didn’t crash every time, maybe once every 5 restarts. Here’s an old thread on the subject:

http://developer.anscamobile.com/forum/2010/09/17/stop-physics

[import]uid: 9422 topic_id: 23150 reply_id: 92685[/import]

Thanks @XenonBL that was it.

I was doing a physics.stop() in my exitScene(). I changed it to physics.pause() there and put the physics.stop() in the destroyScene() event. Problem gone!

[import]uid: 19626 topic_id: 23150 reply_id: 92744[/import]

Thank you.
I had the same bug and this thread has helped me!!!
I had 2 pages crashing, both using physics.start on enter and physics.stop on exit… now I use physics.pause on the

I really think this should be added to the docs… It`s a very hard to track bug!! [import]uid: 79152 topic_id: 23150 reply_id: 124609[/import]

Thank you.
I had the same bug and this thread has helped me!!!
I had 2 pages crashing, both using physics.start on enter and physics.stop on exit… now I use physics.pause on the

I really think this should be added to the docs… It`s a very hard to track bug!! [import]uid: 79152 topic_id: 23150 reply_id: 124609[/import]