mirror of https://github.com/procxx/kepka.git
Fix possible crash in event loop nesting.
This commit is contained in:
parent
fd4f384c3b
commit
b631d09a40
|
@ -534,9 +534,9 @@ void Sandbox::processPostponedCalls(int level) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sandbox::nativeEventFilter(
|
bool Sandbox::nativeEventFilter(
|
||||||
const QByteArray &eventType,
|
const QByteArray &eventType,
|
||||||
void *message,
|
void *message,
|
||||||
long *result) {
|
long *result) {
|
||||||
registerEnterFromEventLoop();
|
registerEnterFromEventLoop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/win/windows_event_filter.h"
|
#include "platform/win/windows_event_filter.h"
|
||||||
|
|
||||||
#include "platform/win/windows_dlls.h"
|
#include "platform/win/windows_dlls.h"
|
||||||
|
#include "core/sandbox.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
|
||||||
|
@ -55,21 +56,23 @@ bool EventFilter::nativeEventFilter(
|
||||||
const QByteArray &eventType,
|
const QByteArray &eventType,
|
||||||
void *message,
|
void *message,
|
||||||
long *result) {
|
long *result) {
|
||||||
const auto msg = static_cast<MSG*>(message);
|
return Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||||
if (msg->message == WM_ENDSESSION) {
|
const auto msg = static_cast<MSG*>(message);
|
||||||
App::quit();
|
if (msg->message == WM_ENDSESSION) {
|
||||||
|
App::quit();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (msg->hwnd == _window->psHwnd()
|
||||||
|
|| msg->hwnd && !_window->psHwnd()) {
|
||||||
|
return mainWindowEvent(
|
||||||
|
msg->hwnd,
|
||||||
|
msg->message,
|
||||||
|
msg->wParam,
|
||||||
|
msg->lParam,
|
||||||
|
(LRESULT*)result);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
});
|
||||||
if (msg->hwnd == _window->psHwnd()
|
|
||||||
|| msg->hwnd && !_window->psHwnd()) {
|
|
||||||
return mainWindowEvent(
|
|
||||||
msg->hwnd,
|
|
||||||
msg->message,
|
|
||||||
msg->wParam,
|
|
||||||
msg->lParam,
|
|
||||||
(LRESULT*)result);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventFilter::mainWindowEvent(
|
bool EventFilter::mainWindowEvent(
|
||||||
|
|
Loading…
Reference in New Issue