From 49ecac4ced6a562f6b0e6491e87ab6d3864f61c9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 Feb 2016 07:37:35 -0800 Subject: [PATCH] Add a mutex lock around the SharedStateManager --- components/resource/scenemanager.cpp | 2 ++ components/resource/scenemanager.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index c2be3960f..eecee813f 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -357,7 +357,9 @@ namespace Resource loaded->accept(setFilterSettingsControllerVisitor); // share state + mSharedStateMutex.lock(); osgDB::Registry::instance()->getOrCreateSharedStateManager()->share(loaded.get()); + mSharedStateMutex.unlock(); if (mIncrementalCompileOperation) mIncrementalCompileOperation->add(loaded); diff --git a/components/resource/scenemanager.hpp b/components/resource/scenemanager.hpp index 173131e66..0345fff22 100644 --- a/components/resource/scenemanager.hpp +++ b/components/resource/scenemanager.hpp @@ -89,6 +89,8 @@ namespace Resource void setUnRefImageDataAfterApply(bool unref); private: + OpenThreads::Mutex mSharedStateMutex; + Resource::ImageManager* mImageManager; Resource::NifFileManager* mNifFileManager;