From 5d1dc4ce6a3581c8cdd2d4575a20a47b88ccfa67 Mon Sep 17 00:00:00 2001 From: "lllucius@gmail.com" Date: Sat, 14 Feb 2015 17:14:23 +0000 Subject: [PATCH] Fix part 2 of bug #857 Gale found that the previous fix for bug #857 didn't completely address all crashes. In this case, the sequence of events: 1) Dynamic module is added to list of module using its name, "VST Effects" 2) Language is set (during init) to one that has "VST Effects" translated 3) Language is changed to something else via preferences, which changes translation of "VST Effects" to something else. 4) During termination, the module is deleted, but since the language has now changed due to translation, it isn't deleted from the list of modules 5) An attempt is made to delete the next module, which happens to be the same one becuase it was never removed from the list. 6) Boom... --- src/ModuleManager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ModuleManager.cpp b/src/ModuleManager.cpp index df17439c6..16b238d43 100644 --- a/src/ModuleManager.cpp +++ b/src/ModuleManager.cpp @@ -215,6 +215,9 @@ ModuleManager::~ModuleManager() while (iter != mDynModules.end()) { UnloadModule(iter->second); + + mDynModules.erase(iter->first); + iter = mDynModules.begin(); } @@ -481,14 +484,10 @@ void ModuleManager::UnloadModule(ModuleInterface *module) { if (module) { - PluginID modID = PluginManager::GetID(module); - module->Terminate(); delete module; - mDynModules.erase(modID); - if (mLibs.find(module) != mLibs.end()) { mLibs[module]->Unload();