diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-28 20:42:32 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-28 20:42:32 +0200 |
commit | 64cd23ff1be1868be5479ad33a99d4c9b394f815 (patch) | |
tree | 0a889da97109b1a3e5b95b49c032d902f2db916f | |
parent | 86e5f80837ad55932f2469d79d9e6b6bb07cf5ed (diff) | |
download | mad-64cd23ff1be1868be5479ad33a99d4c9b394f815.tar mad-64cd23ff1be1868be5479ad33a99d4c9b394f815.zip |
ConfigManager: Fixed a bug causing configure() not to be called on some Configurables registered during configuration
-rw-r--r-- | src/Core/ConfigManager.cpp | 9 | ||||
-rw-r--r-- | src/Core/ConfigManager.h | 3 |
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); } }; |