Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLev Dragunov <l.dragunov@corp.mail.ru>2015-08-28 15:24:23 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:03:25 +0300
commitc331c05746b98ae816d3a86b5e03c4062cb4e97a (patch)
tree7c7eabe48bbd6cd532650c0b5edadb1a8a2faed6 /routing
parent8baa945cfdb94b6295a52792443e7ae5b51803dc (diff)
[routing] Cross mwm cancellation crash fix.
Diffstat (limited to 'routing')
-rw-r--r--routing/cross_mwm_router.cpp6
-rw-r--r--routing/osrm_router.cpp1
-rw-r--r--routing/router_delegate.hpp4
3 files changed, 9 insertions, 2 deletions
diff --git a/routing/cross_mwm_router.cpp b/routing/cross_mwm_router.cpp
index 83e585f936..e1a75cfa60 100644
--- a/routing/cross_mwm_router.cpp
+++ b/routing/cross_mwm_router.cpp
@@ -60,6 +60,8 @@ IRouter::ResultCode CalculateCrossMwmPath(TRoutingNodes const & startGraphNodes,
startGraphNode = start;
break;
}
+ if (delegate.IsCancelled())
+ return IRouter::Cancelled;
}
if (code != IRouter::NoError)
return IRouter::StartPointNotFound;
@@ -76,6 +78,8 @@ IRouter::ResultCode CalculateCrossMwmPath(TRoutingNodes const & startGraphNodes,
finalGraphNode = final;
break;
}
+ if (delegate.IsCancelled())
+ return IRouter::Cancelled;
}
if (code != IRouter::NoError)
return IRouter::EndPointNotFound;
@@ -86,6 +90,8 @@ IRouter::ResultCode CalculateCrossMwmPath(TRoutingNodes const & startGraphNodes,
delegate);
if (code != IRouter::NoError)
return code;
+ if (delegate.IsCancelled())
+ return IRouter::Cancelled;
// Final path conversion to output type.
ConvertToSingleRouterTasks(tempRoad, startGraphNode, finalGraphNode, route);
diff --git a/routing/osrm_router.cpp b/routing/osrm_router.cpp
index f60ca81752..97a425da37 100644
--- a/routing/osrm_router.cpp
+++ b/routing/osrm_router.cpp
@@ -631,6 +631,7 @@ OsrmRouter::ResultCode OsrmRouter::CalculateRoute(m2::PointD const & startPoint,
ResultCode code = CalculateCrossMwmPath(startTask, m_cachedTargets, m_indexManager, delegate,
finalPath);
timer.Reset();
+ INTERRUPT_WHEN_CANCELLED(delegate);
delegate.OnProgress(kCrossPathFoundProgress);
// 5. Make generate answer
diff --git a/routing/router_delegate.hpp b/routing/router_delegate.hpp
index f2373c816e..42c892ad95 100644
--- a/routing/router_delegate.hpp
+++ b/routing/router_delegate.hpp
@@ -35,8 +35,8 @@ public:
RouterDelegate();
/// Set routing progress. Waits current progress status from 0 to 100.
- void OnProgress(float progress) const { m_progressCallback(progress); }
- void OnPointCheck(m2::PointD const & point) const { m_pointCallback(point); }
+ void OnProgress(float progress) const { if (!IsCancelled()) m_progressCallback(progress); }
+ void OnPointCheck(m2::PointD const & point) const { if (!IsCancelled()) m_pointCallback(point); }
void SetProgressCallback(TProgressCallback const & progressCallback);
void SetPointCheckCallback(TPointCheckCallback const & pointCallback);