b3ResizablePool: only remove a handle, if it is currently in-use

also remove user constraints, if removing a body
This commit is contained in:
Erwin Coumans
2017-05-04 13:14:24 -07:00
parent fac3d6e3ca
commit 61999ef789
5 changed files with 53 additions and 7 deletions

View File

@@ -167,11 +167,13 @@ public:
{
b3Assert(handle >= 0);
getHandleInternal(handle)->clear();
getHandleInternal(handle)->setNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
m_numUsedHandles--;
if (m_bodyHandles[handle].getNextFree()==B3_POOL_HANDLE_TERMINAL_USED)
{
getHandleInternal(handle)->clear();
getHandleInternal(handle)->setNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
m_numUsedHandles--;
}
}
};
///end handle management