fix for crash during bogus reconnect on login

This commit is contained in:
Andrew Meadows 2015-06-04 16:57:29 -07:00
parent cd6bf9d461
commit 911baee8b8

View file

@ -153,11 +153,11 @@ void PhysicsEngine::deleteObjects(VectorOfMotionStates& objects) {
}
}
// Same as above, but takes a Set instead of a Vector and ommits some cleanup operations. Only called during teardown.
// Same as above, but takes a Set instead of a Vector. Should only be called during teardown.
void PhysicsEngine::deleteObjects(SetOfMotionStates& objects) {
for (auto object : objects) {
btRigidBody* body = object->getRigidBody();
_dynamicsWorld->removeRigidBody(body);
removeObject(object);
// NOTE: setRigidBody() modifies body->m_userPointer so we should clear the MotionState's body BEFORE deleting it.
object->setRigidBody(nullptr);