Simulator Crash (SIGABRT) on physics.addBody()

I was tinkering with the Physics\DebugDraw project, and I managed to crash the Corona Simulator. Hard. I’ve boiled it down to a minimal test case:

– Start –
[lua]local physics = require(“physics”)
physics.start()

display.setStatusBar( display.HiddenStatusBar )
physics.setDrawMode( “hybrid” )

local lineWidth = 5

local wallShape = { 0, 0, 10, 400, 0, 400, 0, 0 }

local west = display.newLine( 10, 300, 11, 200 )
west.width = lineWidth
local east = display.newLine( 300, 300, 301, 200 )
east.width = lineWidth

physics.addBody( west, “static”, { friction=0.5, bounce=0.3, shape = wallShape } )
physics.addBody( east, “static”, { friction=0.5, bounce=0.3, shape = wallShape } )[/lua]
– End –

This crashes the Corona Simulator every time, and it takes the Corona Terminal window down with it. It can probably be chalked up to a “hundred monkeys” sort of problem, but it’s still a pants-down crash, no matter how you slice it.

Incidentally, what got me started down this road was my desire to figure out why the physics bodies didn’t align with the lines they were tied to. You can see this if you get rid of the “, shape = wallShape” clauses in the last two lines (which stops the crashes).

I’m working on a Macmini2,1 running Snow Leopard 10.6.6. Let me know if you need a crashdump. [import]uid: 5169 topic_id: 5382 reply_id: 305382[/import]

i can duplicate and got the crash log [import]uid: 24 topic_id: 5382 reply_id: 18014[/import]

Cool. Again, let me know if I can help further. [import]uid: 5169 topic_id: 5382 reply_id: 18021[/import]

New insight – It’s the “static” parameter in the physics.addBody() call that breaks it. If, in the above code, you set
[lua]west.bodyType=“static”
east.bodyType=“static”[/lua]
separately, the problem goes away. [import]uid: 5169 topic_id: 5382 reply_id: 18047[/import]

We were able to reproduce the crash with builds 243 and 268; the good news is that the crash no longer occurs in our more recent daily builds. This fix should be available in our next public release. [import]uid: 6787 topic_id: 5382 reply_id: 27138[/import]