Guard QWindowsContext::instance() during screen change on shutdown

Destructing the QWindowsScreenManager might result in a
WM_DISPLAYCHANGE, at which point our QWindowsContext instance
is likely gone. We need to guard against that.

Fixes: QTBUG-117473
Pick-to: 6.6 6.5
Change-Id: If32941c5c11231f7c27e9dde54f4315f18da1100
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-09-22 17:39:28 +02:00
parent ab99cf6077
commit 7d663d2e08

View File

@ -656,7 +656,8 @@ extern "C" LRESULT QT_WIN_CALLBACK qDisplayChangeObserverWndProc(HWND hwnd, UINT
if (QWindowsTheme *t = QWindowsTheme::instance())
t->displayChanged();
QWindowsWindow::displayChanged();
QWindowsContext::instance()->screenManager().handleScreenChanges();
if (auto *context = QWindowsContext::instance())
context->screenManager().handleScreenChanges();
}
return DefWindowProc(hwnd, message, wParam, lParam);