From a9017a829100517e648aea47d1f979199c9acb95 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 13 Jan 2008 02:08:40 +0000 Subject: [PATCH] AutoExecConfig() protects against double-call bugs now (amb 1356) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401852 --- core/systems/PluginSys.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/systems/PluginSys.cpp b/core/systems/PluginSys.cpp index 8a64c450..4e022cca 100644 --- a/core/systems/PluginSys.cpp +++ b/core/systems/PluginSys.cpp @@ -799,6 +799,17 @@ AutoConfig *CPlugin::GetConfig(unsigned int i) void CPlugin::AddConfig(bool autoCreate, const char *cfg, const char *folder) { + /* Do a check for duplicates to prevent double-execution */ + for (size_t i = 0; i < m_configs.size(); i++) + { + if (m_configs[i]->autocfg.compare(cfg) == 0 + && m_configs[i]->folder.compare(folder) == 0 + && m_configs[i]->create == autoCreate) + { + return; + } + } + AutoConfig *c = new AutoConfig; c->autocfg = cfg;