From 225fa2094472f05d2ba846d58334f24d37910765 Mon Sep 17 00:00:00 2001 From: Matt Bennice Date: Thu, 22 Apr 2021 15:32:38 -0700 Subject: [PATCH] Fix memory leak in BulletSoftBody. --- src/BulletSoftBody/btDeformableBodySolver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BulletSoftBody/btDeformableBodySolver.cpp b/src/BulletSoftBody/btDeformableBodySolver.cpp index 4b11fccec..e81680f01 100644 --- a/src/BulletSoftBody/btDeformableBodySolver.cpp +++ b/src/BulletSoftBody/btDeformableBodySolver.cpp @@ -405,6 +405,10 @@ void btDeformableBodySolver::predictMotion(btScalar solverdt) for (int i = 0; i < m_softBodies.size(); ++i) { btSoftBody* psb = m_softBodies[i]; + /* Clear contacts */ + psb->m_nodeRigidContacts.resize(0); + psb->m_faceRigidContacts.resize(0); + psb->m_faceNodeContacts.resize(0); if (psb->isActive()) { @@ -472,10 +476,6 @@ void btDeformableBodySolver::predictDeformableMotion(btSoftBody* psb, btScalar d { psb->updateFaceTree(true, true); } - /* Clear contacts */ - psb->m_nodeRigidContacts.resize(0); - psb->m_faceRigidContacts.resize(0); - psb->m_faceNodeContacts.resize(0); /* Optimize dbvt's */ // psb->m_ndbvt.optimizeIncremental(1); // psb->m_fdbvt.optimizeIncremental(1);