From f79d5d9b6baa3e002c93df22d29eac62de3e618f Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Tue, 24 Sep 2019 12:39:13 +0300 Subject: ANDROID: Use _system->destroy() instead of just delete in JNI::Destroy() --- backends/platform/android/android.cpp | 2 -- backends/platform/android/jni.cpp | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 5614d0a95a..7513639f94 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -129,8 +129,6 @@ OSystem_Android::~OSystem_Android() { delete _savefileManager; _savefileManager = 0; - - ModularBackend::quit(); } void *OSystem_Android::timerThreadFunc(void *arg) { diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index 5e4c116c82..2c27838f6a 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -562,9 +562,13 @@ void JNI::destroy(JNIEnv *env, jobject self) { delete _asset_archive; _asset_archive = 0; - delete _system; + // _system is a pointer of OSystem_Android <--- ModularBackend <--- BaseBacked <--- Common::OSystem + // It's better to call destroy() rather than just delete here + // to avoid mutex issues if a Common::String is used after this point + _system->destroy(); + g_system = 0; - _system = 0; + _system = 0; sem_destroy(&pause_sem); -- cgit v1.2.3