summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-23 13:23:57 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-23 14:24:55 +0200
commitdd90af122154af8ba8cba16c8760c3d2a1d0fcab (patch)
tree08dc64d9960346c4b27f42c7e58ef9d8885ac760 /src/plugins/platforms/ios
parentb24396b925c78a59ef4a59d69a6b2633887aaf2f (diff)
parent5cfb80a28ef6bf6820c970a6c355e6879021e46e (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: mkspecs/common/mac.conf mkspecs/features/configure_base.prf mkspecs/features/configure.prf mkspecs/macx-clang-32/qmake.conf mkspecs/macx-clang/qmake.conf mkspecs/macx-ios-clang/qmake.conf src/network/ssl/qsslsocket_openssl_symbols_p.h Change-Id: I768b592e8e589662b1fdb9b8cbd633fef26845b6
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm6
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm21
2 files changed, 6 insertions, 21 deletions
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index d18e317bfb..50374dc951 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -217,8 +217,12 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
if (surface->surface()->surfaceClass() == QSurface::Offscreen)
return; // Nothing to do
+ // When using threaded rendering, the render-thread may not have picked up
+ // yet on the fact that a window is no longer exposed, and will try to swap
+ // a non-exposed window. This may in some cases result in crashes, e.g. when
+ // iOS is suspending an application, so we have an extra guard here.
if (!static_cast<QIOSWindow *>(surface)->isExposed()) {
- qCWarning(lcQpaGLContext, "Detected swapBuffers on a non-exposed window, skipping flush");
+ qCDebug(lcQpaGLContext, "Detected swapBuffers on a non-exposed window, skipping flush");
return;
}
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 2805eaa304..cddfbe6b06 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -223,26 +223,7 @@ void QIOSWindow::applyGeometry(const QRect &rect)
bool QIOSWindow::isExposed() const
{
- // Note: At startup of an iOS app it will enter UIApplicationStateInactive
- // while showing the launch screen, and once the application returns from
- // applicationDidFinishLaunching it will hide the launch screen and enter
- // UIApplicationStateActive. Technically, a window is not exposed until
- // it's actually visible on screen, and Apple also documents that "Apps
- // that use OpenGL ES for drawing must not use didFinishLaunching to
- // prepare their drawing environment. Instead, defer any OpenGL ES
- // drawing calls to applicationDidBecomeActive". Unfortunately, if we
- // wait until the applicationState reaches ApplicationActive to signal
- // that the window is exposed, we get a lag between hiding the launch
- // screen and blitting the first pixels of the application, as Qt
- // spends some time drawing those pixels in response to the expose.
- // In practice there doesn't seem to be any issues starting GL setup
- // and drawing from within applicationDidFinishLaunching, and this is
- // also the recommended approach for other 3rd party GL toolkits on iOS,
- // so we 'cheat', and report that a window is exposed even if the app
- // is in UIApplicationStateInactive, so that the startup transition
- // between the launch screen and the application content is smooth.
-
- return qApp->applicationState() > Qt::ApplicationHidden
+ return qApp->applicationState() >= Qt::ApplicationActive
&& window()->isVisible() && !window()->geometry().isEmpty();
}