[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48746] trunk/blender/source/gameengine/ Physics/Bullet/CcdPhysicsController.cpp: Fixing a memory leak when using Bullet' s btGImpactMeshShape for triangle meshes (e.g., rigid bodies).

Mitchell Stokes mogurijin at gmail.com
Mon Jul 9 01:15:28 CEST 2012


Revision: 48746
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48746
Author:   moguri
Date:     2012-07-08 23:15:26 +0000 (Sun, 08 Jul 2012)
Log Message:
-----------
Fixing a memory leak when using Bullet's btGImpactMeshShape for triangle meshes (e.g., rigid bodies). The physic controller's free was only handling the case where regular triangle meshes were used.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp	2012-07-08 21:37:59 UTC (rev 48745)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp	2012-07-08 23:15:26 UTC (rev 48746)
@@ -539,6 +539,13 @@
 		if (meshInterface)
 			delete meshInterface;
 	}
+	else if (shape->getShapeType() == GIMPACT_SHAPE_PROXYTYPE)
+	{
+		btGImpactMeshShape* meshShape = static_cast<btGImpactMeshShape*>(shape);
+		btStridingMeshInterface* meshInterface = meshShape->getMeshInterface();
+		if (meshInterface)
+			delete meshInterface;
+	}
 	if (free) {
 		delete shape;
 	}
@@ -2125,7 +2132,6 @@
 						&m_vertexArray[0],
 						3*sizeof(btScalar)
 				);
-				
 				btGImpactMeshShape* gimpactShape =  new btGImpactMeshShape(indexVertexArrays);
 				gimpactShape->setMargin(margin);
 				collisionShape = gimpactShape;




More information about the Bf-blender-cvs mailing list