diff options
author | Constantin Shalnev <c.shalnev@corp.mail.ru> | 2015-08-07 14:17:34 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:59:43 +0300 |
commit | 14ab960c08a7d3975a40c959381855b647e3bd67 (patch) | |
tree | ce7af557131c759599c08d876c53df14877e90a6 /map/framework.cpp | |
parent | 861c0bf9672c8f2d777e54eaea9caa8e1d4b0ba8 (diff) |
Call InsertRoute on the UI thread
Diffstat (limited to 'map/framework.cpp')
-rw-r--r-- | map/framework.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index 520546f868..b865277175 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -2122,7 +2122,7 @@ void Framework::BuildRoute(m2::PointD const & destination, uint32_t timeoutSec) SetLastUsedRouter(m_currentRouterType); - auto fn = [this](Route const & route, IRouter::ResultCode code) + auto readyCallback = [this](Route const & route, IRouter::ResultCode code) { vector<storage::TIndex> absentCountries; vector<storage::TIndex> absentRoutingIndexes; @@ -2150,9 +2150,9 @@ void Framework::BuildRoute(m2::PointD const & destination, uint32_t timeoutSec) }; m_routingSession.BuildRoute(state->Position(), destination, - [fn](Route const & route, IRouter::ResultCode code) + [readyCallback](Route const & route, IRouter::ResultCode code) { - GetPlatform().RunOnGuiThread(bind(fn, route, code)); + GetPlatform().RunOnGuiThread(bind(readyCallback, route, code)); }, m_progressCallback, timeoutSec); } @@ -2256,11 +2256,13 @@ void Framework::CheckLocationForRouting(GpsInfo const & info) m2::PointD const & position = GetLocationState()->Position(); if (m_routingSession.OnLocationPositionChanged(position, info) == RoutingSession::RouteNeedRebuild) { - m_routingSession.RebuildRoute(position, [this] (Route const & route, IRouter::ResultCode code) + auto readyCallback = [this](Route const & route, IRouter::ResultCode code) { if (code == IRouter::NoError) - InsertRoute(route); - }, m_progressCallback, 0 /* timeoutSec */); + GetPlatform().RunOnGuiThread(bind(&Framework::InsertRoute, this, route)); + }; + + m_routingSession.RebuildRoute(position, readyCallback, m_progressCallback, 0 /* timeoutSec */); } } |