Just use g_configs.unload(config) to unload config files.
Avoids concurrent modification errors.
This commit is contained in:
parent
a02c091376
commit
1baad726ae
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -55,7 +55,6 @@ bool Config::unload()
|
|||
if(isLoaded()) {
|
||||
m_confsDoc = nullptr;
|
||||
m_fileName = "";
|
||||
g_configs.remove(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue