Skip to content

Commit

Permalink
Bugfix: crash deleting when activity restarts. Fixes #705.
Browse files Browse the repository at this point in the history
  • Loading branch information
rgmf committed Apr 27, 2021
1 parent 348f697 commit bf552a9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/de/dennisguse/opentracks/TrackDeleteActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,21 @@ public void onCreate(Bundle savedInstanceState) {

runOnUiThread(TrackDeleteActivity.this::onAsyncTaskCompleted);
});
deleteThread.start();
}

@Override
protected void onDestroy() {
super.onDestroy();
viewBinding = null;
}

@Override
protected void onStart() {
super.onStart();
deleteThread.start();
if (deleteThread.getState() == Thread.State.TERMINATED) {
onAsyncTaskCompleted();
}
}

@Override
Expand All @@ -78,12 +87,6 @@ protected void onStop() {
deleteThread.interrupt();
}

@Override
protected void onDestroy() {
super.onDestroy();
viewBinding = null;
}

@Override
protected View getRootView() {
viewBinding = TrackDeleteBinding.inflate(getLayoutInflater());
Expand Down

0 comments on commit bf552a9

Please sign in to comment.