Try to fix NPE while animating thread
Conflicts: OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java
This commit is contained in:
parent
fa407ef386
commit
82512864c5
1 changed files with 8 additions and 7 deletions
|
@ -90,18 +90,19 @@ public class AnimateDraggingMapThread {
|
|||
public void stopAnimatingSync(){
|
||||
// wait until current thread != null
|
||||
stopped = true;
|
||||
while(currentThread != null){
|
||||
Thread tt = null;
|
||||
while((tt = currentThread) != null){
|
||||
try {
|
||||
currentThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
tt.join();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void startThreadAnimating(final Runnable runnable){
|
||||
public synchronized void startThreadAnimating(final Runnable runnable){
|
||||
stopAnimatingSync();
|
||||
stopped = false;
|
||||
currentThread = new Thread(new Runnable() {
|
||||
final Thread t = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -114,8 +115,8 @@ public class AnimateDraggingMapThread {
|
|||
}
|
||||
}
|
||||
}, "Animating Thread");
|
||||
currentThread.start();
|
||||
|
||||
currentThread = t;
|
||||
t.start();
|
||||
}
|
||||
|
||||
public void startMoving(final double finalLat, final double finalLon, final Pair<Integer, Double> finalZoom,
|
||||
|
|
Loading…
Reference in a new issue