bus error when trying to remove an object from a joint in an event handler

The attached 24-line very simple code snippet causes a bus error (=seg fault) when I try to run it in the simulator:

/Applications/Corona Game Edition Beta/simulator: line 9: 2340 Bus error "$path/Corona Simulator.app/Contents/MacOS/Corona Simulator" $\*  

If I remove the object inline, outside of an event handler, all is ok.
Very confusing as it “used to work”… in a much larger program.

Please advise.
Thanks, Frank.
[lua]local physics = require(“physics”)
physics.start()
physics.setScale( 60 )
physics.setGravity( 0, 0 )

physics.setDrawMode(“debug”)

b0 = display.newCircle( 100, 100, 10 )
b0:setFillColor( 0, 255, 0)
physics.addBody( b0, { density=1, friction=0, bounce=0.9, radius=10 } )

b1 = display.newCircle( b0.x, b0.y+20, 10 )
b1:setFillColor( 0, 0, 255)
physics.addBody( b1, { density=1, friction=0, bounce=0.9, radius=10 } )

j01 = physics.newJoint( “pivot”, b0, b1, b0.x, b0.y+10 )

–b1:removeSelf()

afterDelay = function( event )
b1:removeSelf()
end

timer.performWithDelay( 2000, afterDelay)[/lua] [import]uid: 8093 topic_id: 2189 reply_id: 302189[/import]

Ansca: could you please confirm that this is either a bug or a misunderstanding on my part.

I spent quite some time isolating the observed issue into a 24-lines snippet, and a “bus error” is euphemism for seg-fault or core dump…

Thanks, Frank.
[import]uid: 8093 topic_id: 2189 reply_id: 6827[/import]

Frank,
Try commenting out debug mode:

-- physics.setDrawMode("debug")  

I am also having sporadic crashes when setting the DrawMode… Maybe this will be fixed in the next version of Game Edition. I’ve noticed that the Ansca devs are quiet when they are getting close to a new release… just a speculation. :slight_smile: [import]uid: 8194 topic_id: 2189 reply_id: 7022[/import]

Useful info; I don’t think I would have thought of that. Commenting out draw mode call stopped the bus error for me. [import]uid: 3953 topic_id: 2189 reply_id: 7045[/import]

Ouch - that’s nasty!

I kind of excluded the debugging tools from my mental map of potential culprits… what else can you trust :wink:

Thanks for the sharing - seems like a high priority bug to me…

-Frank. [import]uid: 8093 topic_id: 2189 reply_id: 7117[/import]

Fantastic - The last Corona Game Edition 2010.109 seems to have fixed this nasty bug!

Thanks - Frank. [import]uid: 8093 topic_id: 2189 reply_id: 7496[/import]

Awesome! The DrawMode is very handy when creating complex bodies. Glad to know it works now. [import]uid: 8194 topic_id: 2189 reply_id: 7498[/import]