From f71ef554b731eb2bcf701dffa2b6eae4d2d0aef1 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 30 Jun 2017 10:23:33 -0700 Subject: [PATCH] use copy of _entityMap for debug logging --- libraries/entities/src/EntityTree.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 26dc678347..f0e94246b5 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -1526,9 +1526,11 @@ void EntityTree::clearEntityMapEntry(const EntityItemID& id) { } void EntityTree::debugDumpMap() { + // QHash's are implicitly shared, so we make a shared copy and use that instead. + // This way we might be able to avoid both a lock and a true copy. + QHash localMap(_entityMap); qCDebug(entities) << "EntityTree::debugDumpMap() --------------------------"; - QReadLocker locker(&_entityMapLock); - QHashIterator i(_entityMap); + QHashIterator i(localMap); while (i.hasNext()) { i.next(); qCDebug(entities) << i.key() << ": " << i.value()->getElement().get();