From d824c7bcc546d80eabcdad34c9e2c0178a734858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 20 Jan 2015 16:10:26 +0100 Subject: [PATCH] Track QPlatformScreen -> QScreen using QPointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows the QPlatformScreen to verify that the QScreen is alive before sending events to QPA for the given screen (which will assert if the screen is being destroyed). Change-Id: Ie77674fead3e0a4d4f6fedbf1f7f3c98364c7485 Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qplatformintegration.cpp | 1 - src/gui/kernel/qplatformscreen_p.h | 2 +- src/plugins/platforms/ios/qiosviewcontroller.mm | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 98755c3a5e..5eedcabd24 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -461,7 +461,6 @@ void QPlatformIntegration::destroyScreen(QPlatformScreen *screen) { QGuiApplicationPrivate::screen_list.removeOne(screen->d_func()->screen); delete screen->d_func()->screen; - screen->d_func()->screen = Q_NULLPTR; delete screen; } diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h index 42a5503461..fb80bfe662 100644 --- a/src/gui/kernel/qplatformscreen_p.h +++ b/src/gui/kernel/qplatformscreen_p.h @@ -52,7 +52,7 @@ class QScreen; class QPlatformScreenPrivate { public: - QScreen *screen; + QPointer screen; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 84d6628a8a..365de974aa 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -337,6 +337,9 @@ if (!isQtApplication()) return; + if (!m_screen->screen()) + return; + // For now we only care about the main screen, as both the statusbar // visibility and orientation is only appropriate for the main screen. if (m_screen->uiScreen() != [UIScreen mainScreen])