diff --git a/indexer/indexer_tests/osm_editor_test.cpp b/indexer/indexer_tests/osm_editor_test.cpp index 55f8f97370..a7c9f98218 100644 --- a/indexer/indexer_tests/osm_editor_test.cpp +++ b/indexer/indexer_tests/osm_editor_test.cpp @@ -152,6 +152,9 @@ EditorTest::EditorTest() EditorTest::~EditorTest() { + + indexer::tests_support::TearDownEditorForTesting(); + for (auto const & file : m_mwmFiles) Cleanup(file); } diff --git a/indexer/indexer_tests_support/helpers.cpp b/indexer/indexer_tests_support/helpers.cpp index 0f748989e8..9e3b04a9e1 100644 --- a/indexer/indexer_tests_support/helpers.cpp +++ b/indexer/indexer_tests_support/helpers.cpp @@ -13,5 +13,13 @@ void SetUpEditorForTesting(unique_ptr delegate) editor.SetStorageForTesting(make_unique()); editor.ClearAllLocalEdits(); } + +void TearDownEditorForTesting() +{ + auto & editor = osm::Editor::Instance(); + editor.ClearAllLocalEdits(); + editor.SetDelegate({}); + editor.SetDefaultStorage(); +} } // namespace tests_support } // namespace indexer diff --git a/indexer/indexer_tests_support/helpers.hpp b/indexer/indexer_tests_support/helpers.hpp index 5adfbb0768..1a26a3a327 100644 --- a/indexer/indexer_tests_support/helpers.hpp +++ b/indexer/indexer_tests_support/helpers.hpp @@ -12,6 +12,7 @@ namespace indexer namespace tests_support { void SetUpEditorForTesting(unique_ptr delegate); +void TearDownEditorForTesting(); template void EditFeature(FeatureType const & ft, TFn && fn) diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 54212349e2..7d4998e379 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -136,11 +136,9 @@ namespace osm // TODO(AlexZ): Normalize osm multivalue strings for correct merging // (e.g. insert/remove spaces after ';' delimeter); -Editor::Editor() - : m_configLoader(m_config) - , m_notes(editor::Notes::MakeNotes()) - , m_storage(make_unique()) +Editor::Editor() : m_configLoader(m_config), m_notes(editor::Notes::MakeNotes()) { + SetDefaultStorage(); } Editor & Editor::Instance() @@ -149,6 +147,11 @@ Editor & Editor::Instance() return instance; } +void Editor::SetDefaultStorage() +{ + m_storage = make_unique(); +} + void Editor::LoadMapEdits() { if (!m_delegate) diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index daa620dd4e..f83c81e1f0 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -89,6 +89,8 @@ public: m_storage = move(storage); } + void SetDefaultStorage(); + void SetInvalidateFn(TInvalidateFn const & fn) { m_invalidateFn = fn; } void LoadMapEdits(); diff --git a/map/framework.cpp b/map/framework.cpp index 61bc41655e..816c1fb46f 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -491,6 +491,11 @@ Framework::Framework(FrameworkParams const & params) Framework::~Framework() { + osm::Editor & editor = osm::Editor::Instance(); + + editor.SetDelegate({}); + editor.SetInvalidateFn({}); + m_bmManager.Teardown(); m_trafficManager.Teardown(); m_localAdsManager.Teardown(); diff --git a/search/search_tests_support/test_with_custom_mwms.hpp b/search/search_tests_support/test_with_custom_mwms.hpp index a1a0a1c456..f557c70b77 100644 --- a/search/search_tests_support/test_with_custom_mwms.hpp +++ b/search/search_tests_support/test_with_custom_mwms.hpp @@ -25,7 +25,7 @@ public: indexer::tests_support::SetUpEditorForTesting(my::make_unique(m_index)); } - ~TestWithCustomMwms() override = default; + ~TestWithCustomMwms() override { indexer::tests_support::TearDownEditorForTesting(); } template void EditFeature(FeatureID const & id, EditorFn && fn)