diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-06-30 14:18:43 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2017-06-30 15:18:04 +0300 |
commit | 29288e0660c34f7907ab8871413a642c6c3e34a7 (patch) | |
tree | 71eea841f6163884c4fc0236df5090b5447b5b45 /map | |
parent | 77b1719f195613b72fbf5e8160e8d15a38aa5882 (diff) |
fix taxi engine initialization
Diffstat (limited to 'map')
-rw-r--r-- | map/framework.cpp | 23 | ||||
-rw-r--r-- | map/framework.hpp | 1 |
2 files changed, 18 insertions, 6 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index e2401da891..0bc20b3c52 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -356,6 +356,7 @@ void Framework::Migrate(bool keepDownloaded) m_searchEngine.reset(); m_infoGetter.reset(); m_taxiEngine.reset(); + m_cityFinder.reset(); TCountriesVec existedCountries; GetStorage().DeleteAllLocalMaps(&existedCountries); DeregisterAllMaps(); @@ -363,8 +364,9 @@ void Framework::Migrate(bool keepDownloaded) GetStorage().Migrate(keepDownloaded ? existedCountries : TCountriesVec()); InitCountryInfoGetter(); InitSearchEngine(); - RegisterAllMaps(); + InitCityFinder(); InitTaxiEngine(); + RegisterAllMaps(); m_trafficManager.SetCurrentDataVersion(GetStorage().GetCurrentDataVersion()); if (m_drapeEngine && m_isRenderingEnabled) @@ -430,14 +432,19 @@ Framework::Framework(FrameworkParams const & params) m_displayedCategories = make_unique<search::DisplayedCategories>(GetDefaultCategories()); - // To avoid possible races - init country info getter once in constructor. + // To avoid possible races - init country info getter in constructor. InitCountryInfoGetter(); LOG(LDEBUG, ("Country info getter initialized")); - // To avoid possible races - init search engine once in constructor. + // To avoid possible races - init search engine in constructor. InitSearchEngine(); LOG(LDEBUG, ("Search engine initialized")); + InitCityFinder(); + InitTaxiEngine(); + + // All members which re-initialize in Migrate() method should be initialized before RegisterAllMaps(). + // Migrate() can be called from RegisterAllMaps(). RegisterAllMaps(); LOG(LDEBUG, ("Maps initialized")); @@ -472,13 +479,10 @@ Framework::Framework(FrameworkParams const & params) m_trafficManager.SetCurrentDataVersion(m_storage.GetCurrentDataVersion()); - m_cityFinder = make_unique<search::CityFinder>(m_model.GetIndex()); - m_adsEngine = make_unique<ads::Engine>(); InitTransliteration(); LOG(LDEBUG, ("Transliterators initialized")); - InitTaxiEngine(); } Framework::~Framework() @@ -3304,6 +3308,13 @@ void Framework::RegisterCountryFilesOnRoute(std::shared_ptr<routing::NumMwmIds> [&ptr](platform::CountryFile const & file) { ptr->RegisterFile(file); }); } +void Framework::InitCityFinder() +{ + ASSERT(!m_cityFinder, ()); + + m_cityFinder = make_unique<search::CityFinder>(m_model.GetIndex()); +} + void Framework::InitTaxiEngine() { ASSERT(!m_taxiEngine, ()); diff --git a/map/framework.hpp b/map/framework.hpp index 1a43dfbe21..23048ff924 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -840,5 +840,6 @@ private: // taxi::Engine and, therefore, destroyed after taxi::Engine. unique_ptr<taxi::Engine> m_taxiEngine; + void InitCityFinder(); void InitTaxiEngine(); }; |