From 1baad726ae6c4b6aaf2e7bb2942b4430700f5e20 Mon Sep 17 00:00:00 2001 From: BenDol Date: Sun, 6 Apr 2014 15:29:02 +1200 Subject: [PATCH] Just use g_configs.unload(config) to unload config files. Avoids concurrent modification errors. --- modules/corelib/table.lua | 1 + modules/game_interface/gameinterface.lua | 6 ++++-- src/framework/core/config.cpp | 1 - src/framework/core/configmanager.cpp | 1 + src/framework/luafunctions.cpp | 1 - 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/corelib/table.lua b/modules/corelib/table.lua index 044a0c4b..02a1f8aa 100644 --- a/modules/corelib/table.lua +++ b/modules/corelib/table.lua @@ -157,6 +157,7 @@ function table.tostring(t) local maxn = #t local str = "" for k,v in pairs(t) do + v = tostring(v) if k == maxn and k ~= 1 then str = str .. " and " .. v elseif maxn > 1 and k ~= 1 then diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 9c45a65b..19e8fae6 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -783,8 +783,10 @@ function setupViewMode(mode) gameRootPanel:fill('parent') gameLeftPanel:setImageColor('alpha') gameRightPanel:setImageColor('alpha') - gameLeftPanel:setMarginTop(modules.client_topmenu.getTopMenu():getHeight() - gameLeftPanel:getPaddingTop()) - gameRightPanel:setMarginTop(modules.client_topmenu.getTopMenu():getHeight() - gameRightPanel:getPaddingTop()) + gameLeftPanel:setMarginTop(modules.client_topmenu.getTopMenu() + :getHeight() - gameLeftPanel:getPaddingTop()) + gameRightPanel:setMarginTop(modules.client_topmenu.getTopMenu() + :getHeight() - gameRightPanel:getPaddingTop()) gameLeftPanel:setOn(true) gameLeftPanel:setVisible(true) gameRightPanel:setOn(true) diff --git a/src/framework/core/config.cpp b/src/framework/core/config.cpp index 95bbeb08..327079d8 100644 --- a/src/framework/core/config.cpp +++ b/src/framework/core/config.cpp @@ -55,7 +55,6 @@ bool Config::unload() if(isLoaded()) { m_confsDoc = nullptr; m_fileName = ""; - g_configs.remove(this); return true; } return false; diff --git a/src/framework/core/configmanager.cpp b/src/framework/core/configmanager.cpp index 12f0fa73..f0a1e8d5 100644 --- a/src/framework/core/configmanager.cpp +++ b/src/framework/core/configmanager.cpp @@ -117,6 +117,7 @@ bool ConfigManager::unload(const std::string& file) ConfigPtr config = get(file); if(config) { config->unload(); + remove(config); config = nullptr; return true; } diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index cdb3f2be..f074dfcf 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -197,7 +197,6 @@ void Application::registerLuaFunctions() // Config g_lua.registerClass(); g_lua.bindClassMemberFunction("save", &Config::save); - g_lua.bindClassMemberFunction("unload", &Config::unload); g_lua.bindClassMemberFunction("setValue", &Config::setValue); g_lua.bindClassMemberFunction("setList", &Config::setList); g_lua.bindClassMemberFunction("getValue", &Config::getValue);