diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2012-07-09 00:05:40 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2012-07-09 00:05:40 +0400 |
commit | 9af3e3bb9b220a5eba45e964bbec9cd49b707947 (patch) | |
tree | e6619d0727e7a3359b5f965376419def52c943df /source/gameengine | |
parent | 2580575658c17538baf2770ef823cf21c7ec1710 (diff) |
Fixing a memory leak introduced by the Character Physics type patch: a new btGhostPairCallback was being created, but never freed.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 7 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 47cd4ff8da5..3b49607ff1b 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -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; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index ef1c0873005..8d9c770b8c3 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -280,6 +280,8 @@ protected: class CcdOverlapFilterCallBack* m_filterCallback; + class btGhostPairCallback* m_ghostPairCallback; + class btDispatcher* m_ownDispatcher; bool m_scalingPropagated; |