diff options
author | Marius Kintel <marius@kintel.net> | 2012-01-03 19:35:14 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-01-03 19:35:14 (GMT) |
commit | ef7ab1c27513fde693038dc7163836954a018df4 (patch) | |
tree | b91d273215821c89d4ffd9cd36a757f571c10ccb /src/parser.y | |
parent | fac508c8cd3ceef0f0abf1edb7f48f866d8a1232 (diff) |
Small clarification of Don's Windows parser crash fix
Diffstat (limited to 'src/parser.y')
-rw-r--r-- | src/parser.y | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/parser.y b/src/parser.y index 958ef89..3dd933c 100644 --- a/src/parser.y +++ b/src/parser.y @@ -588,17 +588,15 @@ AbstractModule *parse(const char *text, const char *path, int debug) if (!module) return NULL; - std::vector<std::string> to_erase; - - BOOST_FOREACH(Module::ModuleContainer::value_type &m, module->usedlibs) { - module->usedlibs[m.first] = Module::compile_library(m.first); - if (!module->usedlibs[m.first]) { - PRINTF("WARNING: Failed to compile library `%s'.", m.first.c_str()); - to_erase.push_back( m.first ); - } - } - BOOST_FOREACH( std::string s, to_erase ) { - module->usedlibs.erase( s ); + // Iterating manually since we want to modify the container while iterating + Module::ModuleContainer::iterator iter = module->usedlibs.begin(); + while (iter != module->usedlibs.end()) { + Module::ModuleContainer::iterator curr = iter++; + curr->second = Module::compile_library(curr->first); + if (!curr->second) { + PRINTF("WARNING: Failed to compile library `%s'.", curr->first.c_str()); + module->usedlibs.erase(curr); + } } parser_error_pos = -1; |