diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-20 16:34:15 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-04-02 05:50:54 +0100 |
commit | afb32895485e37099e9a297ab093b5e08905a271 (patch) | |
tree | 2a2954d6c00a0e04496ee433c1109a4ec1d72986 | |
parent | 2f030c2cf3fe368be217c0e0b157e050d1c27afc (diff) |
Windows QPA: Prospective fix for crash occurring when changing screen during session lock
Check on currentScreen in QWindowsWindow::checkForScreenChanged().
Fixes: QTBUG-80436
Change-Id: I19e34b9e2c32c9cfc8e5e5b758783c0ab89d5556
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 6c23f006e07b774b0eef863cccd36a992274ca32)
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index febc30c325..b3a8c145d2 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1879,12 +1879,13 @@ void QWindowsWindow::checkForScreenChanged(ScreenChangeMode mode) if (newScreen == nullptr || newScreen == currentScreen) return; // For screens with different DPI: postpone until WM_DPICHANGE - if (mode == FromGeometryChange + // Check on currentScreen as it can be 0 when resuming a session (QTBUG-80436). + if (mode == FromGeometryChange && currentScreen != nullptr && !equalDpi(currentScreen->logicalDpi(), newScreen->logicalDpi())) { return; } qCDebug(lcQpaWindows).noquote().nospace() << __FUNCTION__ - << ' ' << window() << " \"" << currentScreen->name() + << ' ' << window() << " \"" << (currentScreen ? currentScreen->name() : QString()) << "\"->\"" << newScreen->name() << '"'; if (mode == FromGeometryChange) setFlag(SynchronousGeometryChangeEvent); |