From 4103c2b59cccb8d2c42d3751e27dd0f9a94bf77a Mon Sep 17 00:00:00 2001 From: praydog Date: Thu, 26 Oct 2023 15:03:08 -0700 Subject: [PATCH] WindowFilter: Fix deadlock in WndProc --- src/Framework.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Framework.cpp b/src/Framework.cpp index 1bca6b44..50e6773a 100644 --- a/src/Framework.cpp +++ b/src/Framework.cpp @@ -781,7 +781,8 @@ bool Framework::on_message(HWND wnd, UINT message, WPARAM w_param, LPARAM l_para return true; } - if (!WindowFilter::get().is_filtered(wnd)) { + // If we called is_filtered during a WM_GETTEXT message we would deadlock. + if (message != WM_GETTEXT && !WindowFilter::get().is_filtered(wnd)) { m_uevr_shared_memory->data().main_thread_id = GetCurrentThreadId(); } @@ -809,6 +810,9 @@ bool Framework::on_message(HWND wnd, UINT message, WPARAM w_param, LPARAM l_para case WM_KILLFOCUS: std::fill(std::begin(m_last_keys), std::end(m_last_keys), false); break; + case WM_SETFOCUS: + std::fill(std::begin(m_last_keys), std::end(m_last_keys), false); + break; case WM_ACTIVATE: if (LOWORD(w_param) == WA_INACTIVE) { return false;