more memory leak fixes in demo and btSimpleBroadphase.
- deleting object (END key) needs to release - call destructor of pair cache
This commit is contained in:
@@ -417,7 +417,16 @@ void DemoApplication::specialKeyboard(int key, int x, int y)
|
|||||||
if (numObj)
|
if (numObj)
|
||||||
{
|
{
|
||||||
btCollisionObject* obj = getDynamicsWorld()->getCollisionObjectArray()[numObj-1];
|
btCollisionObject* obj = getDynamicsWorld()->getCollisionObjectArray()[numObj-1];
|
||||||
|
|
||||||
getDynamicsWorld()->removeCollisionObject(obj);
|
getDynamicsWorld()->removeCollisionObject(obj);
|
||||||
|
btRigidBody* body = btRigidBody::upcast(obj);
|
||||||
|
if (body && body->getMotionState())
|
||||||
|
{
|
||||||
|
delete body->getMotionState();
|
||||||
|
}
|
||||||
|
delete obj;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ btSimpleBroadphase::~btSimpleBroadphase()
|
|||||||
|
|
||||||
if (m_ownsPairCache)
|
if (m_ownsPairCache)
|
||||||
{
|
{
|
||||||
|
m_pairCache->~btOverlappingPairCache();
|
||||||
btAlignedFree(m_pairCache);
|
btAlignedFree(m_pairCache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ protected:
|
|||||||
void freeHandle(btSimpleBroadphaseProxy* proxy)
|
void freeHandle(btSimpleBroadphaseProxy* proxy)
|
||||||
{
|
{
|
||||||
int handle = int(proxy-m_pHandles);
|
int handle = int(proxy-m_pHandles);
|
||||||
btAssert(handle > 0 && handle < m_maxHandles);
|
btAssert(handle >= 0 && handle < m_maxHandles);
|
||||||
|
|
||||||
proxy->SetNextFree(m_firstFreeHandle);
|
proxy->SetNextFree(m_firstFreeHandle);
|
||||||
m_firstFreeHandle = handle;
|
m_firstFreeHandle = handle;
|
||||||
|
|||||||
Reference in New Issue
Block a user