Fix memory leak

This commit is contained in:
Victor Shcherb 2015-09-10 01:47:54 +02:00
parent 4e50e6ab55
commit 63a94b874d
2 changed files with 5 additions and 5 deletions

View file

@ -84,7 +84,7 @@ public class OsmAndLocationSimulation {
@Override @Override
public boolean processResult(GPXUtilities.GPXFile[] result) { public boolean processResult(GPXUtilities.GPXFile[] result) {
GPXRouteParamsBuilder builder = new GPXRouteParamsBuilder(result[0], app.getSettings()); GPXRouteParamsBuilder builder = new GPXRouteParamsBuilder(result[0], app.getSettings());
startAnimationThread(app.getRoutingHelper(), ma, builder.getPoints(), true, startAnimationThread(app, builder.getPoints(), true,
speedup.getProgress() + 1); speedup.getProgress() + 1);
return true; return true;
} }
@ -94,7 +94,7 @@ public class OsmAndLocationSimulation {
if(currentRoute.isEmpty()) { if(currentRoute.isEmpty()) {
AccessibleToast.makeText(app, R.string.animate_routing_route_not_calculated, Toast.LENGTH_LONG).show(); AccessibleToast.makeText(app, R.string.animate_routing_route_not_calculated, Toast.LENGTH_LONG).show();
} else { } else {
startAnimationThread(app.getRoutingHelper(), ma, new ArrayList<Location>(currentRoute), false, 1); startAnimationThread(app, new ArrayList<Location>(currentRoute), false, 1);
} }
} }
@ -107,8 +107,7 @@ public class OsmAndLocationSimulation {
} }
} }
private void startAnimationThread(final RoutingHelper routingHelper, private void startAnimationThread(final OsmandApplication app, final List<Location> directions, final boolean useLocationTime, final float coeff) {
final MapActivity ma, final List<Location> directions, final boolean useLocationTime, final float coeff) {
final float time = 1.5f; final float time = 1.5f;
routeAnimation = new Thread() { routeAnimation = new Thread() {
@Override @Override
@ -148,7 +147,7 @@ public class OsmAndLocationSimulation {
current.setBearing(prev.bearingTo(current)); current.setBearing(prev.bearingTo(current));
} }
final Location toset = current; final Location toset = current;
ma.runOnUiThread(new Runnable() { app.runInUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
provider.setLocationFromSimulation(toset); provider.setLocationFromSimulation(toset);

View file

@ -548,6 +548,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
recordControl = null; recordControl = null;
mapInfoLayer.recreateControls(); mapInfoLayer.recreateControls();
} }
recordControl = null;
} }
} }