Browse Source

fixing invalid read

iterators just don't survive an erase...
tempestpy_adaptions
gereon 12 years ago
parent
commit
331d3c7a11
  1. 7
      src/utility/settings.cpp

7
src/utility/settings.cpp

@ -74,6 +74,8 @@ Settings::Settings(const int argc, const char* argv[], const char* filename)
// Perform first parse run // Perform first parse run
this->firstRun(argc, argv, filename); this->firstRun(argc, argv, filename);
// Buffer for items to be deleted
std::list< std::pair< std::string, std::string > > deleteQueue;
// Check module triggers // Check module triggers
for (auto it : Settings::modules) for (auto it : Settings::modules)
{ {
@ -83,11 +85,12 @@ Settings::Settings(const int argc, const char* argv[], const char* filename)
if (this->vm[trigger.first].as<std::string>().compare(trigger.second) == 0) if (this->vm[trigger.first].as<std::string>().compare(trigger.second) == 0)
{ {
Settings::desc->add(*it.second); Settings::desc->add(*it.second);
Settings::modules.erase(trigger);
deleteQueue.push_back(trigger);
} }
} }
} }
for (auto it : deleteQueue) Settings::modules.erase(it);
// Stop if help is set // Stop if help is set
if (this->vm.count("help") > 0) if (this->vm.count("help") > 0)

Loading…
Cancel
Save