summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjnimain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/android/androidjnimain.cpp')
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 6419ba2c51..677a2e2626 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -550,8 +550,11 @@ static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/)
static void terminateQt(JNIEnv *env, jclass /*clazz*/)
{
- sem_wait(&m_terminateSemaphore);
- sem_destroy(&m_terminateSemaphore);
+ // QAndroidEventDispatcherStopper is stopped when the user uses the task manager to kill the application
+ if (!QAndroidEventDispatcherStopper::instance()->stopped()) {
+ sem_wait(&m_terminateSemaphore);
+ sem_destroy(&m_terminateSemaphore);
+ }
env->DeleteGlobalRef(m_applicationClass);
env->DeleteGlobalRef(m_classLoaderObject);
if (m_resourcesObj)
@@ -571,8 +574,11 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/)
m_androidPlatformIntegration = nullptr;
delete m_androidAssetsFileEngineHandler;
m_androidAssetsFileEngineHandler = nullptr;
- sem_post(&m_exitSemaphore);
- pthread_join(m_qtAppThread, nullptr);
+
+ if (!QAndroidEventDispatcherStopper::instance()->stopped()) {
+ sem_post(&m_exitSemaphore);
+ pthread_join(m_qtAppThread, nullptr);
+ }
}
static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, jint w, jint h)