diff --git a/tesseract_environment/src/environment.cpp b/tesseract_environment/src/environment.cpp index dd379ce4603..789e0d32969 100644 --- a/tesseract_environment/src/environment.cpp +++ b/tesseract_environment/src/environment.cpp @@ -551,7 +551,7 @@ void Environment::setState(const std::unordered_map& joints currentStateChanged(); } - std::shared_lock lock; + std::shared_lock lock(mutex_); triggerCurrentStateChangedCallbacks(); } @@ -564,7 +564,7 @@ void Environment::setState(const std::vector& joint_names, currentStateChanged(); } - std::shared_lock lock; + std::shared_lock lock(mutex_); triggerCurrentStateChangedCallbacks(); } @@ -816,7 +816,7 @@ tesseract_collision::DiscreteContactManager::UPtr Environment::getDiscreteContac void Environment::clearCachedDiscreteContactManager() const { - std::shared_lock lock; + std::shared_lock lock(mutex_); std::unique_lock discrete_lock(discrete_manager_mutex_); discrete_manager_ = nullptr; }