aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/songloading
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/songloading')
-rw-r--r--src/base/songloading/songloader.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/base/songloading/songloader.cpp b/src/base/songloading/songloader.cpp
index b86f3100..9c1401ec 100644
--- a/src/base/songloading/songloader.cpp
+++ b/src/base/songloading/songloader.cpp
@@ -42,14 +42,17 @@ namespace usdx
strategies[".xml"] = new SongloadingStrategyXml();
}
- Songloader::~Songloader(void)
+ void remove_element(std::pair<std::string, SongloadingStrategy*> e)
{
- std::map<std::string, SongloadingStrategy*>::iterator it;
- for (it = strategies.begin(); it != strategies.end(); it++) {
- delete it->second;
- it->second = NULL;
- }
+ delete e.second;
+ e.second = NULL;
+ }
+ Songloader::~Songloader(void)
+ {
+ // clear memory for all elements in the map
+ std::for_each(strategies.begin(), strategies.end(),
+ remove_element);
strategies.clear();
// remove reference from singleton to make regeneration possible