summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2019-02-11 19:41:48 +0200
committerAndy Shaw <andy.shaw@qt.io>2019-02-28 13:43:21 +0000
commit8880ef79311d283a1357ca0c14be6e56281ba5f0 (patch)
treed22d387f986a4cb86f0b0beba0ed78384cc7da7a /src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
parent077e4993046ee5e564dfcc7710d07c905f2dee83 (diff)
Terminate Qt gracefully
When the application is closed via the task manager on Android then we need to ensure that that the application can close down any running event loops. So we wake up all the event loops and then call quit() directly on the application object to start a graceful termination of the application. In order to aid the graceful termination of Qt then a check is added to ensure that it does not try to create a new surface when the application is suspended. This prevents it from locking while trying to create a new surface when this is not possible. Fixes: QTBUG-70772 Change-Id: I6795b3d280e178d7f1207004a1b965a31a0cc9e9 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformopenglwindow.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglwindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
index 3e1cfe305d..3de5d30623 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
@@ -47,6 +47,7 @@
#include <QSurfaceFormat>
#include <QtGui/private/qwindow_p.h>
+#include <QtGui/qguiapplication.h>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformscreen.h>
@@ -121,7 +122,7 @@ void QAndroidPlatformOpenGLWindow::setGeometry(const QRect &rect)
EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config)
{
- if (QAndroidEventDispatcherStopper::stopped())
+ if (QAndroidEventDispatcherStopper::stopped() || QGuiApplication::applicationState() == Qt::ApplicationSuspended)
return m_eglSurface;
QMutexLocker lock(&m_surfaceMutex);