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>
This commit is contained in:
Friedemann Kleint 2020-01-20 16:34:15 +01:00
parent f59ef938ce
commit 6c23f006e0

View File

@ -1935,12 +1935,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);