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,15 +305,16 @@ bool ObjectMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine*
}
return true;
}
}
if (_shape == newShape) {
// the shape didn't actually change, so we clear the DIRTY_SHAPE flag
flags &= ~Simulation::DIRTY_SHAPE;
// and clear the reference we just created
getShapeManager()->releaseShape(_shape);
} else {
_body->setCollisionShape(const_cast<btCollisionShape*>(newShape));
setShape(newShape);
if (_shape == newShape) {
// the shape didn't actually change, so we clear the DIRTY_SHAPE flag
flags &= ~Simulation::DIRTY_SHAPE;
// and clear the reference we just created
getShapeManager()->releaseShape(_shape);
} else {
_body->setCollisionShape(const_cast<btCollisionShape*>(newShape));
setShape(newShape);
}
}
}
if (flags & EASY_DIRTY_PHYSICS_FLAGS) {

View file

@ -289,6 +289,12 @@ void PhysicsEngine::processTransaction(PhysicsEngine::Transaction& transaction)
bumpAndPruneContacts(object);
btRigidBody* body = object->getRigidBody();
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);
_dynamicsWorld->removeRigidBody(body);