diff --git a/routing/online_absent_fetcher.cpp b/routing/online_absent_fetcher.cpp index f2ebe33852..dee9d5fa21 100644 --- a/routing/online_absent_fetcher.cpp +++ b/routing/online_absent_fetcher.cpp @@ -22,16 +22,18 @@ void OnlineAbsentCountriesFetcher::GenerateRequest(const m2::PointD & startPoint unique_ptr fetcher = make_unique(OSRM_ONLINE_SERVER_URL, MercatorBounds::ToLatLon(startPoint), MercatorBounds::ToLatLon(finalPoint)); - m_fetcherThread.Create(move(fetcher)); + // iOS can't reuse threads. So we need to recreate the thread. + m_fetcherThread.reset(new threads::Thread()); + m_fetcherThread->Create(move(fetcher)); } void OnlineAbsentCountriesFetcher::GetAbsentCountries(vector & countries) { // Check whether a request was scheduled to be run on the thread. - if (!m_fetcherThread.GetRoutine()) + if (!m_fetcherThread->GetRoutine()) return; - m_fetcherThread.Join(); - for (auto const & point : m_fetcherThread.GetRoutineAs()->GetMwmPoints()) + m_fetcherThread->Join(); + for (auto const & point : m_fetcherThread->GetRoutineAs()->GetMwmPoints()) { string name = m_countryFileFn(point); auto localFile = m_countryLocalFileFn(name); diff --git a/routing/online_absent_fetcher.hpp b/routing/online_absent_fetcher.hpp index 88ed3f06a4..79feb98e90 100644 --- a/routing/online_absent_fetcher.hpp +++ b/routing/online_absent_fetcher.hpp @@ -27,6 +27,6 @@ public: private: TCountryFileFn const m_countryFileFn; TCountryLocalFileFn const m_countryLocalFileFn; - threads::Thread m_fetcherThread; + unique_ptr m_fetcherThread; }; } // namespace routing