move the mutex lock to include the 'getNewManifold', dealing with Issue #4117

This commit is contained in:
Erwin Coumans 2022-01-02 21:05:07 -08:00
parent 0ab3b9d9f7
commit 5d1c8a2ece

View File

@ -902,8 +902,8 @@ void btDiscreteDynamicsWorld::createPredictiveContactsInternal(btRigidBody** bod
btVector3 distVec = (predictedTrans.getOrigin() - body->getWorldTransform().getOrigin()) * sweepResults.m_closestHitFraction;
btScalar distance = distVec.dot(-sweepResults.m_hitNormalWorld);
btPersistentManifold* manifold = m_dispatcher1->getNewManifold(body, sweepResults.m_hitCollisionObject);
btMutexLock(&m_predictiveManifoldsMutex);
btPersistentManifold* manifold = m_dispatcher1->getNewManifold(body, sweepResults.m_hitCollisionObject);
m_predictiveManifolds.push_back(manifold);
btMutexUnlock(&m_predictiveManifoldsMutex);