mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Corrected nullptr crash on Windows when going to sleep
This commit is contained in:
parent
8ddd0b2f6f
commit
147c000ef1
@ -45,13 +45,18 @@ bool ScreenLockListenerWin::nativeEventFilter(const QByteArray &eventType, void
|
|||||||
if (eventType == "windows_generic_MSG" || eventType == "windows_dispatcher_MSG") {
|
if (eventType == "windows_generic_MSG" || eventType == "windows_dispatcher_MSG") {
|
||||||
MSG* m = static_cast<MSG *>(message);
|
MSG* m = static_cast<MSG *>(message);
|
||||||
if (m->message == WM_POWERBROADCAST) {
|
if (m->message == WM_POWERBROADCAST) {
|
||||||
const POWERBROADCAST_SETTING* setting = reinterpret_cast<const POWERBROADCAST_SETTING*>(m->lParam);
|
if (m->wParam == PBT_POWERSETTINGCHANGE) {
|
||||||
if (setting->PowerSetting == GUID_LIDSWITCH_STATE_CHANGE) {
|
const POWERBROADCAST_SETTING* setting = reinterpret_cast<const POWERBROADCAST_SETTING*>(m->lParam);
|
||||||
const DWORD* state = reinterpret_cast<const DWORD*>(&setting->Data);
|
if (setting != nullptr && setting->PowerSetting == GUID_LIDSWITCH_STATE_CHANGE) {
|
||||||
if (*state == 0) {
|
const DWORD* state = reinterpret_cast<const DWORD*>(&setting->Data);
|
||||||
Q_EMIT screenLocked();
|
if (*state == 0) {
|
||||||
return true;
|
Q_EMIT screenLocked();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else if (m->wParam == PBT_APMSUSPEND) {
|
||||||
|
Q_EMIT screenLocked();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m->message == WM_WTSSESSION_CHANGE) {
|
if (m->message == WM_WTSSESSION_CHANGE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user