Fixing a memory leak introduced by the Character Physics type patch: a new btGhostPairCallback was being created, but never freed.

This commit is contained in:
Mitchell Stokes
2012-07-08 20:05:40 +00:00
parent 2580575658
commit 9af3e3bb9b
2 changed files with 8 additions and 1 deletions

View File

@@ -338,6 +338,7 @@ m_enableSatCollisionDetection(false),
m_solver(NULL),
m_ownPairCache(NULL),
m_filterCallback(NULL),
m_ghostPairCallback(NULL),
m_ownDispatcher(NULL),
m_scalingPropagated(false)
{
@@ -369,8 +370,9 @@ m_scalingPropagated(false)
}
m_filterCallback = new CcdOverlapFilterCallBack(this);
m_ghostPairCallback = new btGhostPairCallback();
m_broadphase->getOverlappingPairCache()->setOverlapFilterCallback(m_filterCallback);
m_broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
m_broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(m_ghostPairCallback);
setSolverType(1);//issues with quickstep and memory allocations
// m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
@@ -1886,6 +1888,9 @@ CcdPhysicsEnvironment::~CcdPhysicsEnvironment()
if (NULL != m_filterCallback)
delete m_filterCallback;
if (NULL != m_ghostPairCallback)
delete m_ghostPairCallback;
if (NULL != m_collisionConfiguration)
delete m_collisionConfiguration;

View File

@@ -280,6 +280,8 @@ protected:
class CcdOverlapFilterCallBack* m_filterCallback;
class btGhostPairCallback* m_ghostPairCallback;
class btDispatcher* m_ownDispatcher;
bool m_scalingPropagated;