From d865ff10147eec372d01502f4286f81ddb215ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Thu, 7 Jul 2011 13:09:17 +0200 Subject: [PATCH] Forgot suspend and resume in cleanmap, leading to race conditions and segfaults. --- plugins/cleanmap.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/cleanmap.cpp b/plugins/cleanmap.cpp index ce52d9e71..01cb530e5 100644 --- a/plugins/cleanmap.cpp +++ b/plugins/cleanmap.cpp @@ -44,6 +44,7 @@ DFhackCExport command_result cleanmap (Core * c, vector & parameters) else if(parameters[i] == "mud") mud = true; } + c->Suspend(); vector splatter; DFHack::Maps *Mapz = c->getMaps(); @@ -51,6 +52,7 @@ DFhackCExport command_result cleanmap (Core * c, vector & parameters) if(!Mapz->Start()) { dfout << "Can't init map." << std::endl; + c->Resume(); return CR_FAILURE; } @@ -89,5 +91,6 @@ DFhackCExport command_result cleanmap (Core * c, vector & parameters) } } } + c->Resume(); return CR_OK; }