forked from github_mirror/framelesshelper
win: add one more safe guard
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
7534a4631c
commit
a23438b02b
|
@ -625,7 +625,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
// Work-around a bug caused by typo which only exists in Qt 5.11.1
|
// Work-around a bug caused by typo which only exists in Qt 5.11.1
|
||||||
const auto msg = *static_cast<MSG **>(message);
|
const auto msg = *static_cast<MSG **>(message);
|
||||||
#else
|
#else
|
||||||
const auto msg = static_cast<LPMSG>(message);
|
const auto msg = static_cast<const MSG *>(message);
|
||||||
#endif
|
#endif
|
||||||
const HWND hWnd = msg->hwnd;
|
const HWND hWnd = msg->hwnd;
|
||||||
if (!hWnd) {
|
if (!hWnd) {
|
||||||
|
@ -633,6 +633,10 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
// Anyway, we should skip the entire processing in this case.
|
// Anyway, we should skip the entire processing in this case.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Let's be extra safe.
|
||||||
|
if (IsWindow(hWnd) == FALSE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const UINT uMsg = msg->message;
|
const UINT uMsg = msg->message;
|
||||||
// WM_QUIT won't be posted to the WindowProc function.
|
// WM_QUIT won't be posted to the WindowProc function.
|
||||||
if ((uMsg == WM_CLOSE) || (uMsg == WM_DESTROY)) {
|
if ((uMsg == WM_CLOSE) || (uMsg == WM_DESTROY)) {
|
||||||
|
|
Loading…
Reference in New Issue