diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2014-10-03 14:24:40 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@digia.com> | 2014-10-20 10:23:47 +0200 |
commit | 1fe8a708cbdb957be55b6162c5379102a46b3ed8 (patch) | |
tree | d16d33e17c7f1e4269c10a35ed438ce0df7900c5 /src/plugins/platforms/android/qandroidplatformopenglwindow.cpp | |
parent | 1faba97683ec42155acd7ed51d14f65bb240bc75 (diff) |
Android: deadlock avoidance
This change adds deadlock protection to all places where we lock
one thread while waiting for the other to do something. If we
detect that the other thread is going to block, we abort the
operation. This could cause unexpected problems, such as painting
errors, text input errors, or even crashes, but the alternative is
a guaranteed deadlock.
Task-number: QTBUG-41369
Change-Id: I2627a955cfafc4bce54eb9d0d38e19b768b06956
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformopenglwindow.cpp')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformopenglwindow.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 8afc35c57a..8dc8e84f0a 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -37,6 +37,7 @@ #include "qandroidplatformscreen.h" #include "androidjnimain.h" #include "qandroideventdispatcher.h" +#include "androiddeadlockprotector.h" #include <QSurfaceFormat> #include <QtGui/private/qwindow_p.h> @@ -120,6 +121,10 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config) QMutexLocker lock(&m_surfaceMutex); if (m_nativeSurfaceId == -1) { + AndroidDeadlockProtector protector; + if (!protector.acquire()) + return m_eglSurface; + const bool windowStaysOnTop = bool(window()->flags() & Qt::WindowStaysOnTopHint); m_nativeSurfaceId = QtAndroid::createSurface(this, geometry(), windowStaysOnTop, 32); m_surfaceWaitCondition.wait(&m_surfaceMutex); |