Fix lock ui and crash while calc route

This commit is contained in:
Alexey Kulish 2016-03-30 17:25:00 +03:00
parent 1e05e51d72
commit 02757c1878
2 changed files with 10 additions and 7 deletions

View file

@ -51,7 +51,12 @@ public class CurrentPositionHelper {
ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, app.getResourceManager().getRoutingMapFiles()); ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, app.getResourceManager().getRoutingMapFiles());
RoutingConfiguration defCfg = app.getDefaultRoutingConfig().build(GeneralRouterProfile.CAR.name().toLowerCase(), 10, RoutingConfiguration defCfg = app.getDefaultRoutingConfig().build(GeneralRouterProfile.CAR.name().toLowerCase(), 10,
new HashMap<String, String>()); new HashMap<String, String>());
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);
} }

View file

@ -921,12 +921,10 @@ public class RoutingHelper {
currentRunningJob = new Thread(new Runnable() { currentRunningJob = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
synchronized (RoutingHelper.this) { try {
try { r.run();
r.run(); } finally {
} finally { currentRunningJob = null;
currentRunningJob = null;
}
} }
} }
}, "Calculating position"); //$NON-NLS-1$ }, "Calculating position"); //$NON-NLS-1$