forked from organicmaps/organicmaps
[map] Fixed Framework shutdown.
This commit is contained in:
parent
006506aad3
commit
97e745281e
7 changed files with 27 additions and 5 deletions
|
@ -152,6 +152,9 @@ EditorTest::EditorTest()
|
|||
|
||||
EditorTest::~EditorTest()
|
||||
{
|
||||
|
||||
indexer::tests_support::TearDownEditorForTesting();
|
||||
|
||||
for (auto const & file : m_mwmFiles)
|
||||
Cleanup(file);
|
||||
}
|
||||
|
|
|
@ -13,5 +13,13 @@ void SetUpEditorForTesting(unique_ptr<osm::Editor::Delegate> delegate)
|
|||
editor.SetStorageForTesting(make_unique<editor::InMemoryStorage>());
|
||||
editor.ClearAllLocalEdits();
|
||||
}
|
||||
|
||||
void TearDownEditorForTesting()
|
||||
{
|
||||
auto & editor = osm::Editor::Instance();
|
||||
editor.ClearAllLocalEdits();
|
||||
editor.SetDelegate({});
|
||||
editor.SetDefaultStorage();
|
||||
}
|
||||
} // namespace tests_support
|
||||
} // namespace indexer
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace indexer
|
|||
namespace tests_support
|
||||
{
|
||||
void SetUpEditorForTesting(unique_ptr<osm::Editor::Delegate> delegate);
|
||||
void TearDownEditorForTesting();
|
||||
|
||||
template <typename TFn>
|
||||
void EditFeature(FeatureType const & ft, TFn && fn)
|
||||
|
|
|
@ -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::LocalStorage>())
|
||||
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<editor::LocalStorage>();
|
||||
}
|
||||
|
||||
void Editor::LoadMapEdits()
|
||||
{
|
||||
if (!m_delegate)
|
||||
|
|
|
@ -89,6 +89,8 @@ public:
|
|||
m_storage = move(storage);
|
||||
}
|
||||
|
||||
void SetDefaultStorage();
|
||||
|
||||
void SetInvalidateFn(TInvalidateFn const & fn) { m_invalidateFn = fn; }
|
||||
|
||||
void LoadMapEdits();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
indexer::tests_support::SetUpEditorForTesting(my::make_unique<EditorDelegate>(m_index));
|
||||
}
|
||||
|
||||
~TestWithCustomMwms() override = default;
|
||||
~TestWithCustomMwms() override { indexer::tests_support::TearDownEditorForTesting(); }
|
||||
|
||||
template <typename EditorFn>
|
||||
void EditFeature(FeatureID const & id, EditorFn && fn)
|
||||
|
|
Loading…
Add table
Reference in a new issue