diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2012-07-09 03:15:26 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2012-07-09 03:15:26 +0400 |
commit | 4ff0efd5a2a1790f7f4407d732bf01ec3d2f00b3 (patch) | |
tree | ab87300e08b13738cea044bbcf4e94d73f06c333 /source/gameengine/Physics/Bullet | |
parent | 75a5eab8d13fee1cec9e8fd1538f0aa15ef3b72f (diff) |
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.
Diffstat (limited to 'source/gameengine/Physics/Bullet')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 21158a9461d..c7ba17e7f97 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -539,6 +539,13 @@ static void DeleteBulletShape(btCollisionShape* shape, bool free) 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 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b &m_vertexArray[0], 3*sizeof(btScalar) ); - btGImpactMeshShape* gimpactShape = new btGImpactMeshShape(indexVertexArrays); gimpactShape->setMargin(margin); collisionShape = gimpactShape; |