Track QPlatformScreen -> QScreen using QPointer

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 <simon.hausmann@digia.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
bb10
Tor Arne Vestbø 2015-01-20 16:10:26 +01:00 committed by Tor Arne Vestbø
parent b26dc9bc05
commit d824c7bcc5
3 changed files with 4 additions and 2 deletions

View File

@ -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;
}

View File

@ -52,7 +52,7 @@ class QScreen;
class QPlatformScreenPrivate
{
public:
QScreen *screen;
QPointer<QScreen> screen;
};
QT_END_NAMESPACE

View File

@ -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])