mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
fix crash bug
when obj deleted but dangling pointer still on _pendingAdd which would not be removed during getObjectsToDelete() because backpointers had been disconnected
This commit is contained in:
parent
00c6944125
commit
fe5cfdf495
1 changed files with 6 additions and 0 deletions
|
@ -67,6 +67,12 @@ void PhysicalEntitySimulation::removeEntityInternal(EntityItem* entity) {
|
|||
if (motionState) {
|
||||
motionState->clearEntity();
|
||||
entity->setPhysicsInfo(nullptr);
|
||||
|
||||
// NOTE: we must remove entity from _pendingAdds immediately because we've disconnected the backpointers between
|
||||
// motionState and entity and they can't be used to look up each other. However we don't need to remove
|
||||
// motionState from _pendingChanges at this time becuase it will be removed during getObjectsToDelete().
|
||||
_pendingAdds.remove(entity);
|
||||
|
||||
_pendingRemoves.insert(motionState);
|
||||
_outgoingChanges.remove(motionState);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue