Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp @@ -718,6 +718,11 @@ // Copy the old map settings, so we don't lose them if the map generation fails AtObj oldSettings = settings; + // Deactivate tools, so they don't carry forwards into the new CWorld + // and crash. + m_ScenarioEditor.GetToolManager().SetCurrentTool(_T("")); + // TODO: clear the undo buffer, etc + AtlasMessage::qGenerateMap qry((std::wstring)scriptName.wc_str(), json); qry.Post(); @@ -729,6 +734,8 @@ } m_ScenarioEditor.NotifyOnMapReload(); + + m_ScenarioEditor.GetCommandProc().ClearCommands(); } void MapSidebar::OnOpenPlayerPanel(wxCommandEvent& WXUNUSED(evt))