Just use g_configs.unload(config) to unload config files.

Avoids concurrent modification errors.
This commit is contained in:
BenDol 2014-04-06 15:29:02 +12:00
parent a02c091376
commit 1baad726ae
5 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -55,7 +55,6 @@ bool Config::unload()
if(isLoaded()) {
m_confsDoc = nullptr;
m_fileName = "";
g_configs.remove(this);
return true;
}
return false;

View File

@ -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;
}

View File

@ -197,7 +197,6 @@ void Application::registerLuaFunctions()
// Config
g_lua.registerClass<Config>();
g_lua.bindClassMemberFunction<Config>("save", &Config::save);
g_lua.bindClassMemberFunction<Config>("unload", &Config::unload);
g_lua.bindClassMemberFunction<Config>("setValue", &Config::setValue);
g_lua.bindClassMemberFunction<Config>("setList", &Config::setList);
g_lua.bindClassMemberFunction<Config>("getValue", &Config::getValue);