Skip to content

Commit

Permalink
Resolved crash when downloading forms from Google Server (getodk#2169)
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshyagupta21 authored and lognaturel committed May 14, 2018
1 parent fb4bd52 commit eb3c9ee
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,17 +491,6 @@ public void taskComplete(HashMap<String, Object> results) {

}

@Override
protected void onPause() {
if (retrieveDriveFileContentsAsyncTask != null) {
retrieveDriveFileContentsAsyncTask.setTaskListener(null);
}
if (getFileTask != null) {
getFileTask.setGoogleDriveFormDownloadListener(null);
}
super.onPause();
}

@Override
protected void onResume() {
super.onResume();
Expand Down Expand Up @@ -546,6 +535,24 @@ protected void onStop() {
super.onStop();
}

@Override
protected void onDestroy() {
if (retrieveDriveFileContentsAsyncTask != null) {
if (!retrieveDriveFileContentsAsyncTask.isCancelled()) {
retrieveDriveFileContentsAsyncTask.cancel(true);
}
retrieveDriveFileContentsAsyncTask.setTaskListener(null);
}
if (getFileTask != null) {
if (!getFileTask.isCancelled()) {
getFileTask.cancel(true);
}
getFileTask.setGoogleDriveFormDownloadListener(null);
}
finish();
super.onDestroy();
}

public void listFiles(String dir, String query) {
setProgressBarIndeterminateVisibility(true);
adapter = null;
Expand Down

0 comments on commit eb3c9ee

Please sign in to comment.