From 80d8466a470565d1d823b66e3b81dcc306d04f61 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 1 Apr 2016 14:13:38 +0200 Subject: Android: correctly use mutex for texture rendering. Some sections were not protected by the mutex, even though they should have been. An example of problem that could happen because of this was if the SurfaceTexture was reset while the render thread was rendering that texture. Change-Id: Ie95860fd4eb722bbac04cccc430cc1a8abf1df4d Reviewed-by: Christian Stromme --- src/plugins/android/src/common/qandroidvideooutput.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/android/src/common') diff --git a/src/plugins/android/src/common/qandroidvideooutput.cpp b/src/plugins/android/src/common/qandroidvideooutput.cpp index 82c27035d..87a725a93 100644 --- a/src/plugins/android/src/common/qandroidvideooutput.cpp +++ b/src/plugins/android/src/common/qandroidvideooutput.cpp @@ -218,6 +218,8 @@ bool QAndroidTextureVideoOutput::initSurfaceTexture() return false; } + QMutexLocker locker(&m_mutex); + m_surfaceTexture = new AndroidSurfaceTexture(m_externalTex); if (m_surfaceTexture->surfaceTexture() != 0) { @@ -235,6 +237,7 @@ bool QAndroidTextureVideoOutput::initSurfaceTexture() void QAndroidTextureVideoOutput::clearSurfaceTexture() { + QMutexLocker locker(&m_mutex); if (m_surfaceTexture) { delete m_surfaceTexture; m_surfaceTexture = 0; -- cgit v1.2.3