QT应用在Android 10设备上的std :: thread的析构函数处崩溃 [英] QT app crashes at the destructor of std::thread on Android 10 devices

查看:259
本文介绍了QT应用在Android 10设备上的std :: thread的析构函数处崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用在具有以下调用堆栈的 Android 10 设备上崩溃:

My app crashes on Android 10 devices with the following call stack:

backtrace:
#00  pc 000000000006f06c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160)
#01  pc 00000000000500fc  /system/lib64/libc++.so (abort_message+232)
#02  pc 0000000000050218  /system/lib64/libc++.so (demangling_terminate_handler()+44)
#03  pc 00000000000646c4  /system/lib64/libc++.so (std::__terminate(void (*)())+12)
#04  pc 000000000006466c  /system/lib64/libc++.so (std::terminate()+52)
#05  pc 00000000000bb150  /system/lib64/libc++.so (std::__1::thread::~thread()+20)
#06  pc 00000000000d0f48  /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+212)
#07  pc 00000000000cc930  /apex/com.android.runtime/lib64/bionic/libc.so (exit+24)
#08  pc 0000000000032f30  /data/app/com.domain.myapp-Rs_sm5VrLR1Jj8QW6oYByA==/lib/arm64/libplugins_platforms_qtforandroid_arm64-v8a.so

我不知道何时以及为什么会发生这种情况,因为我无法在设备和仿真器上重现这种情况,但是这种情况在用户端密集地发生,并且仅在 Android 10 上发生(不适用于以前的版本Android版本).

I have no idea when and why this happens, because I can't reproduce this on my devices and emulators, but this intensively happens at the user side and only on Android 10 (not on previous Android versions).

我的 QT 版本是5.14.2.

My QT version is 5.14.2.

推荐答案

我们刚刚发布了其中一款游戏的更新,看起来崩溃已修复.这是我们所做的:使用Android后退按钮时,Android 10和Android 9显示不同的默认行为.在Android 10上,该应用程序已关闭,但在控制台输出上,我看到该应用程序在真正退出之前陷入了大约5秒钟的循环中.在Android 9上不会发生这种情况.这是当我按下后退"按钮并关闭应用程序时在Android 10设备上获得的输出:

We've just released an update for one of our games and it looks as if the crash is fixed. This is what we did: Android 10 and Android 9 show a different default behaviour when using the Android back button. On Android 10 the app closes but on the console output I see the app being stuck in a loop for about 5 seconds before it really quits. This does not happen on Android 9. This is the output I get on an Android 10 device when I hit the back button and the app closes:

....
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent before read
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent after read, length = -1
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent
05-04 18:26:21.315 26882 26908 I
...

我现在在QML中到处都有Android后退按钮,当用户确实要退出该应用程序时,我调用以下自定义Java函数来正常退出:

I am now catching the Android back button everywhere In QML and when the user really wants to quit the app, I call the following custom Java function to quit gracefully:

public String quitApp() { // Qt C++ call

    try {
        finishAffinity();
        System.exit(0);

    } catch (Exception exc) {
        exc.printStackTrace();
        logException(exc);
    }
    return "";
}

我们还实现了David K. Hess的建议.

We have also implemented the what David K. Hess suggested.

这篇关于QT应用在Android 10设备上的std :: thread的析构函数处崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆