Since Gideros uses Box2d physics engine, there is still same restriction that removing or changing the objects on collision might cause app crashes. So when we define collision event we want to delay removing or changing object. And here is how we can do that:

--define event handler function
local function onBeginContact(e)
	--getting contact bodies
	local fixtureA = e.fixtureA
	local fixtureB = e.fixtureB
	local bodyA = fixtureA:getBody()
	local bodyB = fixtureB:getBody()
	
	--creating timer to delay removing bodies
	--1 milisecond
	Timer.delayedCall(1, function() 
		--remove bodies
		world:destroyBody(bodyA)
		world:destroyBody(bodyB)
	end)
end


--add event listener
world:addEventListener(Event.BEGIN_CONTACT, onBeginContact)