Forgot suspend and resume in cleanmap, leading to race conditions and segfaults.

develop
Petr Mrázek 2011-07-07 13:09:17 +02:00
parent 367d79bcfa
commit d865ff1014
1 changed files with 3 additions and 0 deletions

@ -44,6 +44,7 @@ DFhackCExport command_result cleanmap (Core * c, vector <string> & parameters)
else if(parameters[i] == "mud") else if(parameters[i] == "mud")
mud = true; mud = true;
} }
c->Suspend();
vector<DFHack::t_spattervein *> splatter; vector<DFHack::t_spattervein *> splatter;
DFHack::Maps *Mapz = c->getMaps(); DFHack::Maps *Mapz = c->getMaps();
@ -51,6 +52,7 @@ DFhackCExport command_result cleanmap (Core * c, vector <string> & parameters)
if(!Mapz->Start()) if(!Mapz->Start())
{ {
dfout << "Can't init map." << std::endl; dfout << "Can't init map." << std::endl;
c->Resume();
return CR_FAILURE; return CR_FAILURE;
} }
@ -89,5 +91,6 @@ DFhackCExport command_result cleanmap (Core * c, vector <string> & parameters)
} }
} }
} }
c->Resume();
return CR_OK; return CR_OK;
} }