mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
lock when changing EntityTree elements
This commit is contained in:
parent
a0c6c49360
commit
fe79514b08
1 changed files with 6 additions and 5 deletions
|
@ -90,16 +90,17 @@ void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
|||
if (_simulation) {
|
||||
_simulation->clearEntities();
|
||||
}
|
||||
{
|
||||
QWriteLocker locker(&_entityMapLock);
|
||||
foreach(EntityItemPointer entity, _entityMap) {
|
||||
QHash<EntityItemID, EntityItemPointer> localMap;
|
||||
localMap.swap(_entityMap);
|
||||
this->withWriteLock([&] {
|
||||
foreach(EntityItemPointer entity, localMap) {
|
||||
EntityTreeElementPointer element = entity->getElement();
|
||||
if (element) {
|
||||
element->cleanupEntities();
|
||||
}
|
||||
}
|
||||
_entityMap.clear();
|
||||
}
|
||||
});
|
||||
localMap.clear();
|
||||
Octree::eraseAllOctreeElements(createNewRoot);
|
||||
|
||||
resetClientEditStats();
|
||||
|
|
Loading…
Reference in a new issue