From 488f7a31ffbe86730d7dc885a3e71e8cc56b506f Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 6 Aug 2013 17:18:46 +0200 Subject: [PATCH] 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 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qplatformscreen.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index 43db0e5f8e..05d04ae4ee 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -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(); }