Small clarification of Don's Windows parser crash fix

felipesanches-svg
Marius Kintel 2012-01-03 20:35:14 +01:00
parent fac508c8cd
commit ef7ab1c275
1 changed files with 9 additions and 11 deletions

View File

@ -588,18 +588,16 @@ AbstractModule *parse(const char *text, const char *path, int debug)
if (!module) if (!module)
return NULL; return NULL;
std::vector<std::string> to_erase; // Iterating manually since we want to modify the container while iterating
Module::ModuleContainer::iterator iter = module->usedlibs.begin();
BOOST_FOREACH(Module::ModuleContainer::value_type &m, module->usedlibs) { while (iter != module->usedlibs.end()) {
module->usedlibs[m.first] = Module::compile_library(m.first); Module::ModuleContainer::iterator curr = iter++;
if (!module->usedlibs[m.first]) { curr->second = Module::compile_library(curr->first);
PRINTF("WARNING: Failed to compile library `%s'.", m.first.c_str()); if (!curr->second) {
to_erase.push_back( m.first ); PRINTF("WARNING: Failed to compile library `%s'.", curr->first.c_str());
module->usedlibs.erase(curr);
} }
} }
BOOST_FOREACH( std::string s, to_erase ) {
module->usedlibs.erase( s );
}
parser_error_pos = -1; parser_error_pos = -1;
return module; return module;