Don't crash if the QWindow's screen is temporarily invalid

It can happen during the transition between screens when one screen
is disconnected that the window doesn't have a screen.

Task-number: QTBUG-32681
Change-Id: I066855a2ffe80f0680a3044e73f4f491c2c0eb5c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
Shawn Rutledge 2013-08-06 17:18:46 +02:00 committed by The Qt Project
parent bf7129af97
commit 488f7a31ff

View File

@ -232,6 +232,10 @@ void QPlatformScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window)
{
// QTBUG 32681: It can happen during the transition between screens
// when one screen is disconnected that the window doesn't have a screen.
if (!window->screen())
return 0;
return window->screen()->handle();
}