minimize the lock context

This commit is contained in:
Andrew Meadows 2017-06-30 10:28:43 -07:00
parent f71ef554b7
commit 02bc9b9610

View file

@ -1500,8 +1500,11 @@ int EntityTree::processEraseMessageDetails(const QByteArray& dataByteArray, cons
}
EntityTreeElementPointer EntityTree::getContainingElement(const EntityItemID& entityItemID) /*const*/ {
QReadLocker locker(&_entityMapLock);
EntityItemPointer entity = _entityMap.value(entityItemID);
EntityItemPointer entity;
{
QReadLocker locker(&_entityMapLock);
entity = _entityMap.value(entityItemID);
}
if (entity) {
return entity->getElement();
}