diff options
author | Yuhang Zhao <2546789017@qq.com> | 2022-05-08 21:35:05 +0800 |
---|---|---|
committer | Yuhang Zhao <2546789017@qq.com> | 2022-05-10 05:14:58 +0800 |
commit | 71322ef36142570edc94c361ceb21f770303aceb (patch) | |
tree | e9b6954cf026ad3f5b21e4fc97debeba05f924bf /src/plugins/platforms/windows/qwindowscontext.cpp | |
parent | 741afd67529ccc51b2686f59f897b6136e041719 (diff) |
Windows QPA: Fix crash in some rare cases
For the WM_SETTINGCHANGE message, lParam sometimes may be NULL [1]
and that will lead to crash without extra safe guard.
Amends commit qtbase/1ed449e168af133184633d174fd7339a13d1d595
[1] https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-settingchange
Change-Id: Ibd1e94b4c1d7882db0719c31a66a5fcc9299c3bd
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index a5963de478..6bce851aac 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1138,7 +1138,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::SettingChangedEvent: { QWindowsWindow::settingsChanged(); // Only refresh the window theme if the user changes the personalize settings. - if (wParam == 0 && wcscmp(reinterpret_cast<LPCWSTR>(lParam), L"ImmersiveColorSet") == 0) { + if ((wParam == 0) && (lParam != 0) // lParam sometimes may be NULL. + && (wcscmp(reinterpret_cast<LPCWSTR>(lParam), L"ImmersiveColorSet") == 0)) { const bool darkMode = QWindowsTheme::queryDarkMode(); if (darkMode != QWindowsContextPrivate::m_darkMode) { QWindowsContextPrivate::m_darkMode = darkMode; |