From 8dc14d2fe61c03071d1e7edc97cc804dc2b4f032 Mon Sep 17 00:00:00 2001 From: codereader Date: Sun, 10 Dec 2017 08:52:56 +0100 Subject: [PATCH] Fixup EClassManager to not clear out entityDefs in unrealise(), since we might be reloading the defs. Clear the EClassManager members in the shutdownModule() method instead. --- plugins/eclassmgr/EClassManager.cpp | 14 +++++++++++--- plugins/shaders/Doom3ShaderSystem.cpp | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/eclassmgr/EClassManager.cpp b/plugins/eclassmgr/EClassManager.cpp index 89d04dee72..eb6479c94c 100644 --- a/plugins/eclassmgr/EClassManager.cpp +++ b/plugins/eclassmgr/EClassManager.cpp @@ -242,8 +242,6 @@ void EClassManager::unrealise() { // This waits for any threaded work to finish _defLoader.reset(); - - _entityClasses.clear(); _realised = false; } } @@ -317,8 +315,18 @@ void EClassManager::initialiseModule(const ApplicationContext& ctx) void EClassManager::shutdownModule() { rMessage() << "EntityClassDoom3::shutdownModule called." << std::endl; - unrealise(); + GlobalFileSystem().removeObserver(*this); + + // Unrealise ourselves and wait for threads to finish + unrealise(); + + // Don't notify anyone anymore + _defsReloadedSignal.clear(); + + // Clear member structures + _entityClasses.clear(); + _models.clear(); } // This takes care of relading the entityDefs and refreshing the scenegraph diff --git a/plugins/shaders/Doom3ShaderSystem.cpp b/plugins/shaders/Doom3ShaderSystem.cpp index f7e203649a..5772808709 100644 --- a/plugins/shaders/Doom3ShaderSystem.cpp +++ b/plugins/shaders/Doom3ShaderSystem.cpp @@ -143,11 +143,13 @@ void Doom3ShaderSystem::ensureDefsLoaded() } } -void Doom3ShaderSystem::onFileSystemInitialise() { +void Doom3ShaderSystem::onFileSystemInitialise() +{ realise(); } -void Doom3ShaderSystem::onFileSystemShutdown() { +void Doom3ShaderSystem::onFileSystemShutdown() +{ unrealise(); }