diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 756f3b0c6..8b9f3dfec 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -134,10 +134,15 @@ namespace Physic RigidBody::RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name) - :btRigidBody(CI),mName(name) + : btRigidBody(CI) + , mName(name) { + } - }; + RigidBody::~RigidBody() + { + delete getMotionState(); + } @@ -155,8 +160,7 @@ namespace Physic // The actual physics solver solver = new btSequentialImpulseConstraintSolver; - //TODO: memory leak? - btOverlappingPairCache* pairCache = new btSortedOverlappingPairCache(); + pairCache = new btSortedOverlappingPairCache(); //pairCache->setInternalGhostPairCallback( new btGhostPairCallback() ); broadphase = new btDbvtBroadphase(pairCache); @@ -237,6 +241,7 @@ namespace Physic delete collisionConfiguration; delete dispatcher; delete broadphase; + delete pairCache; delete mShapeLoader; } diff --git a/libs/openengine/bullet/physic.hpp b/libs/openengine/bullet/physic.hpp index 200b96207..57ffe9130 100644 --- a/libs/openengine/bullet/physic.hpp +++ b/libs/openengine/bullet/physic.hpp @@ -108,7 +108,7 @@ namespace Physic { public: RigidBody(btRigidBody::btRigidBodyConstructionInfo& CI,std::string name); - virtual ~RigidBody() {} + virtual ~RigidBody(); std::string mName; //is this body used for raycasting only? @@ -211,6 +211,7 @@ namespace Physic std::list PEventList; //Bullet Stuff + btOverlappingPairCache* pairCache; btBroadphaseInterface* broadphase; btDefaultCollisionConfiguration* collisionConfiguration; btSequentialImpulseConstraintSolver* solver;