summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-09-22 17:39:28 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-10-09 15:25:54 +0200
commit7d663d2e08fb71801f0f1f084a124e706722bf0f (patch)
tree818c7790d31e7f80bac1a2691bca2743e568ba6c
parentab99cf6077962df1d2e9624840fb578854aac378 (diff)
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>
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 6b85a68f69..677a4dcade 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -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);