From 80564f0121b6197cd8b4af28a1df57018e9bcf00 Mon Sep 17 00:00:00 2001 From: Julien Maille Date: Sat, 28 Nov 2026 13:46:02 +0100 Subject: [PATCH] fix(win32): preserve the window context across nested messages --- src/core/contexts/win32windowcontext.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index ebaa63d..9efd33c 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -655,10 +656,9 @@ namespace QWK { return ::CallWindowProcW(g_qtWindowProc, hWnd, message, wParam, lParam); } - WindowsNativeEventFilter::lastMessageContext = ctx; - const auto &contextCleaner = qScopeGuard([]() { - WindowsNativeEventFilter::lastMessageContext = nullptr; // - }); + // Nested window messages must preserve the context of the outer dispatch. + const QScopedValueRollback contextGuard( + WindowsNativeEventFilter::lastMessageContext, ctx); // Since Qt does the necessary processing of the WM_NCCALCSIZE message, we need to // forward it right away and process it in our native event filter.