From f4b8697c40bd476ef6bf83418e144adce7c7d4a3 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 3 Feb 2015 13:05:20 +0100 Subject: Handle gracefully the removal and re-attachment of all QScreens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't crash; restore windows when all screens are removed and re-added. xcb: on configure notify, check for screen change: it may be that a window belonging to a screen which was removed has now gotten mapped to the new screen. On screen change, send a synthetic expose event, because the real expose events already happened. Task-number: QTBUG-38326 Task-number: QTBUG-32973 Task-number: QTBUG-42985 Change-Id: If334f55c248468ad3c95e7066bb14eca377d2050 Reviewed-by: Jørgen Lind --- src/gui/kernel/qplatformwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/kernel/qplatformwindow.cpp') diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 167bd44f0e..763ab68868 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -83,7 +83,8 @@ QPlatformWindow *QPlatformWindow::parent() const */ QPlatformScreen *QPlatformWindow::screen() const { - return window()->screen()->handle(); + QScreen *scr = window()->screen(); + return scr ? scr->handle() : Q_NULLPTR; } /*! @@ -479,7 +480,7 @@ QString QPlatformWindow::formatWindowTitle(const QString &title, const QString & QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) const { QPlatformScreen *currentScreen = screen(); - if (!parent() && !currentScreen->geometry().intersects(newGeometry)) { + if (!parent() && currentScreen && !currentScreen->geometry().intersects(newGeometry)) { Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { if (screen->geometry().intersects(newGeometry)) return screen; -- cgit v1.2.3