aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinjie Pan <408488316@qq.com>2019-09-19 06:37:06 +0800
committersfan5 <sfan5@live.de>2019-09-19 00:37:06 +0200
commit6a7f5c09852e06b2204cda67583de84e895fb78a (patch)
tree741a84027f38acb3e93cb32638d7a4174f020d40
parent4271889ef832806e7bd57e552f15b24fdf162c8d (diff)
downloadminetest-6a7f5c09852e06b2204cda67583de84e895fb78a.tar.gz
minetest-6a7f5c09852e06b2204cda67583de84e895fb78a.tar.bz2
minetest-6a7f5c09852e06b2204cda67583de84e895fb78a.zip
Fix misuse of AsyncTask (#8799)
-rw-r--r--build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java b/build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java
index b570fe61a..03b34f705 100644
--- a/build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java
+++ b/build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java
@@ -53,6 +53,14 @@ public class MinetestAssetCopy extends Activity {
super.onResume();
makeFullScreen();
}
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (m_AssetCopy != null) {
+ m_AssetCopy.cancel(true);
+ }
+ }
public void makeFullScreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
@@ -77,7 +85,7 @@ public class MinetestAssetCopy extends Activity {
return this;
}
- private class copyAssetTask extends AsyncTask<String, Integer, String> {
+ private static class copyAssetTask extends AsyncTask<String, Integer, String> {
boolean m_copy_started = false;
String m_Foldername = "media";
Vector<String> m_foldernames;