From 483dc9de45d63184879cfe6a781bfb4a2d115e11 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 7 May 2015 23:17:30 +0200 Subject: [PATCH] Stop viewer threading before changing MyGUI textures --- apps/openmw/mwgui/windowmanagerimp.cpp | 4 ++++ components/myguiplatform/myguitexture.hpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 6421df824..40180d700 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1092,7 +1092,11 @@ namespace MWGui else if (it->first == "GUI" && it->second == "subtitles") mSubtitlesEnabled = Settings::Manager::getBool ("subtitles", "GUI"); else if (it->first == "GUI" && it->second == "menu transparency") + { + mViewer->stopThreading(); setMenuTransparency(Settings::Manager::getFloat("menu transparency", "GUI")); + mViewer->startThreading(); + } } } diff --git a/components/myguiplatform/myguitexture.hpp b/components/myguiplatform/myguitexture.hpp index de385e94d..109858bc8 100644 --- a/components/myguiplatform/myguitexture.hpp +++ b/components/myguiplatform/myguitexture.hpp @@ -42,6 +42,8 @@ namespace osgMyGUI virtual void destroy(); + /// @warning If you intend to change a texture during the frame update, you must either declare the texture with DataVariance::DYNAMIC + /// or temporarily stop the viewer threading, to prevent race conditions with the draw thread. virtual void* lock(MyGUI::TextureUsage access); virtual void unlock(); virtual bool isLocked();