From 94e725dc2a07c0219ce379e0a658c560d78e067b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 25 Jul 2019 11:33:19 -0700 Subject: [PATCH] Fix rare case where script would fail to set LOD after disabling auto LOD --- interface/src/LODManager.cpp | 2 ++ interface/src/LODManager.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/interface/src/LODManager.cpp b/interface/src/LODManager.cpp index 2cba5f9b1b..2973208fef 100644 --- a/interface/src/LODManager.cpp +++ b/interface/src/LODManager.cpp @@ -54,6 +54,7 @@ void LODManager::setRenderTimes(float presentTime, float engineRunTime, float ba } void LODManager::autoAdjustLOD(float realTimeDelta) { + std::lock_guard { _automaticLODLock }; // The "render time" is the worse of: // - engineRunTime: Time spent in the render thread in the engine producing the gpu::Frame N @@ -235,6 +236,7 @@ void LODManager::resetLODAdjust() { } void LODManager::setAutomaticLODAdjust(bool value) { + std::lock_guard { _automaticLODLock }; _automaticLODAdjust = value; emit autoLODChanged(); } diff --git a/interface/src/LODManager.h b/interface/src/LODManager.h index 6fd9904906..8fd39e7161 100644 --- a/interface/src/LODManager.h +++ b/interface/src/LODManager.h @@ -12,6 +12,8 @@ #ifndef hifi_LODManager_h #define hifi_LODManager_h +#include + #include #include #include @@ -230,6 +232,7 @@ signals: private: LODManager(); + std::mutex _automaticLODLock; bool _automaticLODAdjust = true; float _presentTime{ 0.0f }; // msec