Merge pull request #14346 from AndrewMeadows/fix-crash-19654

Case 19654: fix crash in btCollisionWorld::updateSingleAabb()
This commit is contained in:
Sam Gateau 2018-11-07 16:09:36 -08:00 committed by GitHub
commit 4489efa58b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View file

@ -305,7 +305,7 @@ bool ObjectMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine*
} }
return true; return true;
} }
} } else {
if (_shape == newShape) { if (_shape == newShape) {
// the shape didn't actually change, so we clear the DIRTY_SHAPE flag // the shape didn't actually change, so we clear the DIRTY_SHAPE flag
flags &= ~Simulation::DIRTY_SHAPE; flags &= ~Simulation::DIRTY_SHAPE;
@ -316,6 +316,7 @@ bool ObjectMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine*
setShape(newShape); setShape(newShape);
} }
} }
}
if (flags & EASY_DIRTY_PHYSICS_FLAGS) { if (flags & EASY_DIRTY_PHYSICS_FLAGS) {
handleEasyChanges(flags); handleEasyChanges(flags);
} }

View file

@ -289,6 +289,12 @@ void PhysicsEngine::processTransaction(PhysicsEngine::Transaction& transaction)
bumpAndPruneContacts(object); bumpAndPruneContacts(object);
btRigidBody* body = object->getRigidBody(); btRigidBody* body = object->getRigidBody();
if (body) { if (body) {
if (body->isStaticObject() && _activeStaticBodies.size() > 0) {
std::set<btRigidBody*>::iterator itr = _activeStaticBodies.find(body);
if (itr != _activeStaticBodies.end()) {
_activeStaticBodies.erase(itr);
}
}
removeDynamicsForBody(body); removeDynamicsForBody(body);
_dynamicsWorld->removeRigidBody(body); _dynamicsWorld->removeRigidBody(body);