From 942baec9f6bd138b8f49d3a2ab8ee1dfe6c947d9 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 30 Mar 2016 17:25:00 +0300 Subject: [PATCH] Fix lock ui and crash while calc route --- OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java | 7 ++++++- OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java b/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java index ede940c386..b4deade8e9 100644 --- a/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java +++ b/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java @@ -51,7 +51,12 @@ public class CurrentPositionHelper { ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, app.getResourceManager().getRoutingMapFiles()); RoutingConfiguration defCfg = app.getDefaultRoutingConfig().build(GeneralRouterProfile.CAR.name().toLowerCase(), 10, new HashMap()); - defCtx = new RoutePlannerFrontEnd(false).buildRoutingContext(defCfg, null, app.getResourceManager().getRoutingMapFiles()); + BinaryMapIndexReader[] rs = new BinaryMapIndexReader[app.getResourceManager().getAddressRepositories().size()]; + int i = 0; + for (RegionAddressRepository rep : app.getResourceManager().getAddressRepositories()) { + rs[i++] = rep.getFile(); + } + defCtx = new RoutePlannerFrontEnd(false).buildRoutingContext(defCfg, null, rs); } diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 73fd932879..76851e38bf 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -921,12 +921,10 @@ public class RoutingHelper { currentRunningJob = new Thread(new Runnable() { @Override public void run() { - synchronized (RoutingHelper.this) { - try { - r.run(); - } finally { - currentRunningJob = null; - } + try { + r.run(); + } finally { + currentRunningJob = null; } } }, "Calculating position"); //$NON-NLS-1$