Fixed memory leaks in love.physics. When a World is garbage-collected it now implicitly calls World:destroy, which also destroys all Bodies, Fixtures, and Joints that belong to it.

This commit is contained in:
Alex Szpakowski
2015-11-17 01:27:48 -04:00
parent a81621df82
commit aca369e5d4
4 changed files with 11 additions and 17 deletions
+3 -7
View File
@@ -435,13 +435,9 @@ private:
**/
int pushVector(lua_State *L, const b2Vec2 &v);
// We need a shared_ptr to the parent World,
// because World can not be destroyed as long as
// bodies exists in it.
//
// This ensures that a World only can be destroyed
// once all bodies have been destroyed too.
StrongRef<World> world;
// FIXME: This should be a weak reference, rather than being completely
// unowned?
World *world;
bodyudata *udata;