summaryrefslogtreecommitdiffstats
path: root/src/Core
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-09-28 20:42:32 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-09-28 20:42:32 +0200
commit64cd23ff1be1868be5479ad33a99d4c9b394f815 (patch)
tree0a889da97109b1a3e5b95b49c032d902f2db916f /src/Core
parent86e5f80837ad55932f2469d79d9e6b6bb07cf5ed (diff)
downloadmad-64cd23ff1be1868be5479ad33a99d4c9b394f815.tar
mad-64cd23ff1be1868be5479ad33a99d4c9b394f815.zip
ConfigManager: Fixed a bug causing configure() not to be called on some Configurables registered during configuration
Diffstat (limited to 'src/Core')
-rw-r--r--src/Core/ConfigManager.cpp9
-rw-r--r--src/Core/ConfigManager.h3
2 files changed, 10 insertions, 2 deletions
diff --git a/src/Core/ConfigManager.cpp b/src/Core/ConfigManager.cpp
index 1cb4aa0..e9cc87e 100644
--- a/src/Core/ConfigManager.cpp
+++ b/src/Core/ConfigManager.cpp
@@ -106,8 +106,13 @@ void ConfigManager::configure() {
if(configured)
return;
- for(std::set<Configurable*, Compare>::iterator c = configurables.begin(); c != configurables.end(); ++c)
- (*c)->configure();
+ while(!unconfiguredConfigurables.empty()) {
+ std::set<Configurable*, Compare>::iterator it = unconfiguredConfigurables.begin();
+ Configurable *c = *it;
+ unconfiguredConfigurables.erase(it);
+
+ c->configure();
+ }
configured = true;
}
diff --git a/src/Core/ConfigManager.h b/src/Core/ConfigManager.h
index 2c11de9..9869f5a 100644
--- a/src/Core/ConfigManager.h
+++ b/src/Core/ConfigManager.h
@@ -45,6 +45,7 @@ class MAD_CORE_EXPORT ConfigManager : public ConfigEntry {
Application *application;
std::set<Configurable*, Compare> configurables;
+ std::set<Configurable*, Compare> unconfiguredConfigurables;
bool configured;
ConfigManager(Application *application0) : application(application0), configured(false) {}
@@ -55,10 +56,12 @@ class MAD_CORE_EXPORT ConfigManager : public ConfigEntry {
void registerConfigurable(Configurable *c) {
configurables.insert(c);
+ unconfiguredConfigurables.insert(c);
}
void unregisterConfigurable(Configurable *c) {
configurables.erase(c);
+ unconfiguredConfigurables.erase(c);
}
};