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>
This commit is contained in:
parent
741afd6752
commit
71322ef361
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user