Android: print correct return code of main()

... and print it always after main() returns.

Task-number: QTBUG-118077
Change-Id: I1f57b3f7a646d01eebf67d4a4ff6a8d9f6e82cc7
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
Assam Boudjelthia 2022-03-05 13:55:04 +02:00
parent d2e163d2e4
commit 9a58062a73

View File

@ -517,7 +517,8 @@ static void startQtApplication(JNIEnv */*env*/, jclass /*clazz*/)
argv[argc] = nullptr;
startQtAndroidPluginCalled.fetchAndAddRelease(1);
int ret = m_main(argc, argv.data());
const int ret = m_main(argc, argv.data());
qInfo() << "main() returned" << ret;
if (m_mainLibraryHnd) {
int res = dlclose(m_mainLibraryHnd);
@ -525,10 +526,8 @@ static void startQtApplication(JNIEnv */*env*/, jclass /*clazz*/)
qWarning() << "dlclose failed:" << dlerror();
}
if (m_applicationClass) {
qWarning("exit app 0");
if (m_applicationClass)
QJniObject::callStaticMethod<void>(m_applicationClass, "quitApp", "()V");
}
sem_post(&m_terminateSemaphore);
sem_wait(&m_exitSemaphore);