From 6a7f5c09852e06b2204cda67583de84e895fb78a Mon Sep 17 00:00:00 2001 From: Linjie Pan <408488316@qq.com> Date: Thu, 19 Sep 2019 06:37:06 +0800 Subject: [PATCH] Fix misuse of AsyncTask (#8799) --- .../java/net.minetest.minetest/MinetestAssetCopy.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 { + private static class copyAssetTask extends AsyncTask { boolean m_copy_started = false; String m_Foldername = "media"; Vector m_foldernames; -- 2.25.1