From 92bcef0192d72a6155492f25bd4b4a08e4f74fa5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Moskal Date: Thu, 2 Feb 2023 15:02:25 +0100 Subject: Android: Properly clean AndroidSurfaceTexture before deleting After commit: d4e02d9efd6e8e41aa1a83c0f3d6534d138e7ae3, deadlock from QAndroidTextureVideoOutput was removed. Necessary cleanup for m_rhi member (which was created in thread of AndroidTextureThread) was also added. After that, during the clean up, we can still get a crash with log error: F libapptestVideo_arm64-v8a.so: Cannot make QOpenGLContext current in a different thread F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 28160 (qtMainLoopThrea), pid 28130 To avoid that, we need to be sure, that m_rhi was cleared before m_surfaceThread was stopped. That is why clearSurfaceTexture is called as BlockingQueuedConnection. Fixes: QTBUG-110797 Change-Id: I35aa72c8416a99c5372f93d455bc23963fa182e4 Reviewed-by: Samuel Mira Reviewed-by: Lars Knoll (cherry picked from commit d3f0b75e3c1e98988eec439bf51945e4047ff2af) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/multimedia/android/common/qandroidvideooutput.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp index 43f2cd760..8ec0ec9d2 100644 --- a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp +++ b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp @@ -348,7 +348,8 @@ QAndroidTextureVideoOutput::QAndroidTextureVideoOutput(QVideoSink *sink, QObject QAndroidTextureVideoOutput::~QAndroidTextureVideoOutput() { - QMetaObject::invokeMethod(m_surfaceThread.get(), &AndroidTextureThread::clearSurfaceTexture); + QMetaObject::invokeMethod(m_surfaceThread.get(), + &AndroidTextureThread::clearSurfaceTexture, Qt::BlockingQueuedConnection); m_surfaceThread->quit(); m_surfaceThread->wait(); } -- cgit v1.2.3