Browse Source

Fix a leak on destruction of a physics world

Bart van Strien 13 years ago
parent
commit
a67b5b501f
1 changed files with 3 additions and 6 deletions
  1. 3 6
      src/modules/physics/box2d/World.cpp

+ 3 - 6
src/modules/physics/box2d/World.cpp

@@ -234,12 +234,6 @@ namespace box2d
 		world->Step(dt, 8, 6);
 
 		// Destroy all objects marked during the time step.
-		if (destructWorld)
-		{
-			destroy();
-			return;
-		}
-
 		for (std::vector<Body*>::iterator i = destructBodies.begin(); i < destructBodies.end(); i++)
 		{
 			Body * b = *i;
@@ -264,6 +258,9 @@ namespace box2d
 		destructBodies.clear();
 		destructFixtures.clear();
 		destructJoints.clear();
+
+		if (destructWorld)
+			destroy();
 	}
 
 	void World::BeginContact(b2Contact* contact)