This commit is contained in:
Erwin Coumans
2018-07-27 10:13:09 +02:00
parent a696bd6a46
commit d7c68dd822

View File

@@ -156,10 +156,12 @@ public:
btCollisionObjectWrapper compoundWrap(this->m_compoundColObjWrap,childShape,m_compoundColObjWrap->getCollisionObject(),newChildWorldTrans,-1,index); btCollisionObjectWrapper compoundWrap(this->m_compoundColObjWrap,childShape,m_compoundColObjWrap->getCollisionObject(),newChildWorldTrans,-1,index);
btCollisionAlgorithm* algo = 0; btCollisionAlgorithm* algo = 0;
bool allocatedAlgorithm = false;
if (m_resultOut->m_closestPointDistanceThreshold > 0) if (m_resultOut->m_closestPointDistanceThreshold > 0)
{ {
algo = m_dispatcher->findAlgorithm(&compoundWrap, m_otherObjWrap, 0, BT_CLOSEST_POINT_ALGORITHMS); algo = m_dispatcher->findAlgorithm(&compoundWrap, m_otherObjWrap, 0, BT_CLOSEST_POINT_ALGORITHMS);
allocatedAlgorithm = true;
} }
else else
{ {
@@ -204,7 +206,11 @@ public:
{ {
m_resultOut->setBody1Wrap(tmpWrap); m_resultOut->setBody1Wrap(tmpWrap);
} }
if(allocatedAlgorithm)
{
algo->~btCollisionAlgorithm();
m_dispatcher->freeCollisionAlgorithm(algo);
}
} }
} }
void Process(const btDbvtNode* leaf) void Process(const btDbvtNode* leaf)