mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge pull request #6877 from AndrewMeadows/crash-fix
fix interface crash when deleting lots of objects at once
This commit is contained in:
commit
1a98ab3fba
2 changed files with 5 additions and 2 deletions
|
@ -142,6 +142,7 @@ void PhysicalEntitySimulation::clearEntitiesInternal() {
|
|||
// finally clear all lists maintained by this class
|
||||
_physicalObjects.clear();
|
||||
_entitiesToRemoveFromPhysics.clear();
|
||||
_entitiesToRelease.clear();
|
||||
_entitiesToAddToPhysics.clear();
|
||||
_pendingChanges.clear();
|
||||
_outgoingChanges.clear();
|
||||
|
@ -157,6 +158,7 @@ void PhysicalEntitySimulation::prepareEntityForDelete(EntityItemPointer entity)
|
|||
// end EntitySimulation overrides
|
||||
|
||||
void PhysicalEntitySimulation::getObjectsToRemoveFromPhysics(VectorOfMotionStates& result) {
|
||||
_entitiesToRelease.clear();
|
||||
result.clear();
|
||||
QMutexLocker lock(&_mutex);
|
||||
for (auto entity: _entitiesToRemoveFromPhysics) {
|
||||
|
@ -171,7 +173,7 @@ void PhysicalEntitySimulation::getObjectsToRemoveFromPhysics(VectorOfMotionState
|
|||
_entitiesToDelete.insert(entity);
|
||||
}
|
||||
}
|
||||
_entitiesToRemoveFromPhysics.clear();
|
||||
_entitiesToRemoveFromPhysics.swap(_entitiesToRelease);
|
||||
}
|
||||
|
||||
void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& result) {
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
|
||||
private:
|
||||
SetOfEntities _entitiesToRemoveFromPhysics;
|
||||
SetOfEntities _entitiesToRelease;
|
||||
SetOfEntities _entitiesToAddToPhysics;
|
||||
|
||||
SetOfEntityMotionStates _pendingChanges; // EntityMotionStates already in PhysicsEngine that need their physics changed
|
||||
|
@ -70,7 +71,7 @@ private:
|
|||
PhysicsEnginePointer _physicsEngine = nullptr;
|
||||
EntityEditPacketSender* _entityPacketSender = nullptr;
|
||||
|
||||
uint32_t _lastStepSendPackets = 0;
|
||||
uint32_t _lastStepSendPackets { 0 };
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue