Joints and crashes
Posted: Tue Jan 07, 2014 1:16 am
Whenever I try to delete a physics object I have, it worked fine and it deletes, but if the physics object has a mouse joint attached, it errors because the mouse joint was accessed, but it was destroyed and I have no way to check if it is destroyed or not. Furthermore, when I destroy an object with a weld joint attached, love crashes oughtright and windows shows the 'love.exe has stopped working' screen. I have tested the crash on 0.9.0 and nightly windows and my friend has tested it on 0.9.0 ubuntu.
Here is the code of the function that destroys objects. The caller passes the object to remove as self and each object gets it's own remove function so that
is possible in a for loop
here is function (also in for loop going through all objects):
it's on line 158 of the main file.
here is .love file:
EDIT:
to cause the mouse joint error, hold onto the scientist and crash him into a wall really hard then wait a few seconds for him to fade out
to cause the weld joint crash, hit escape and enable weld mode, then resume and fling scientist into a wall really hard and wait a few seconds for him to fade out.
Here is the code of the function that destroys objects. The caller passes the object to remove as self and each object gets it's own remove function so that
Code: Select all
if thing thing then
objects[k].remove(k)
end
here is function (also in for loop going through all objects):
Code: Select all
v.remove = function(self)
objects[self].body:destroy()
objects[self] = nil
table.remove(objects, tonumber(k))
end
here is .love file:
EDIT:
to cause the mouse joint error, hold onto the scientist and crash him into a wall really hard then wait a few seconds for him to fade out
to cause the weld joint crash, hit escape and enable weld mode, then resume and fling scientist into a wall really hard and wait a few seconds for him to fade out.