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,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;