diff --git a/libraries/entities/src/EntitySimulation.cpp b/libraries/entities/src/EntitySimulation.cpp index 246a82c88d..c7eb906efb 100644 --- a/libraries/entities/src/EntitySimulation.cpp +++ b/libraries/entities/src/EntitySimulation.cpp @@ -43,6 +43,7 @@ void EntitySimulation::updateEntities() { } void EntitySimulation::removeEntityFromInternalLists(EntityItemPointer entity) { + // protected: _mutex lock is guaranteed // remove from all internal lists except _deadEntitiesToRemoveFromTree _entitiesToSort.remove(entity); _simpleKinematicEntities.remove(entity); @@ -144,6 +145,7 @@ void EntitySimulation::sortEntitiesThatMoved() { } void EntitySimulation::addEntityToInternalLists(EntityItemPointer entity) { + // protected: _mutex lock is guaranteed if (entity->isMortal()) { _mortalEntities.insert(entity); uint64_t expiry = entity->getExpiry(); diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index b5ba65a098..4a2ee9184f 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -171,6 +171,8 @@ void PhysicalEntitySimulation::processChangedEntity(const EntityItemPointer& ent } void PhysicalEntitySimulation::processDeadEntities() { + // Note: this override is a complete rewite of the base class's method because we cannot assume all entities + // are domain entities, and the consequence of trying to delete a domain-entity in this case is very different. if (_deadEntitiesToRemoveFromTree.empty()) { return; }