3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-27 21:55:28 +02:00

Ensure the tree lock is always taken before the simulation lock

This commit is contained in:
Atlante45 2018-04-24 13:43:09 -07:00
parent 236e75b6c6
commit d82333534c
2 changed files with 10 additions and 8 deletions
assignment-client/src/entities
libraries/entities/src

View file

@ -380,10 +380,15 @@ void EntityServer::trackSend(const QUuid& dataID, quint64 dataLastEdited, const
}
void EntityServer::trackViewerGone(const QUuid& sessionID) {
QWriteLocker locker(&_viewerSendingStatsLock);
_viewerSendingStats.remove(sessionID);
{
QWriteLocker locker(&_viewerSendingStatsLock);
_viewerSendingStats.remove(sessionID);
}
if (_entitySimulation) {
_entitySimulation->clearOwnership(sessionID);
_tree->withReadLock([&] {
_entitySimulation->clearOwnership(sessionID);
});
}
}

View file

@ -38,11 +38,8 @@ void SimpleEntitySimulation::clearOwnership(const QUuid& ownerID) {
entity->clearSimulationOwnership();
entity->markAsChangedOnServer();
if (auto element = entity->getElement()) {
auto tree = getEntityTree();
tree->withReadLock([&] {
DirtyOctreeElementOperator op(element);
tree->recurseTreeWithOperator(&op);
});
DirtyOctreeElementOperator op(element);
getEntityTree()->recurseTreeWithOperator(&op);
}
} else {
++itemItr;