From 44a37b5912f024c5339b35fa61a572a8b3100560 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 7 Apr 2021 02:08:48 +0100 Subject: [PATCH] Fix handling exceptions from wxEVT_CHAR_HOOK handlers in wxMSW Catch all the exceptions when processing this event from the keyboard hook as they must not escape from it and outside of the application. Closes #19133. --- src/msw/window.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 2c5e6b8051..be2685431d 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -7184,7 +7184,9 @@ wxKeyboardHook(int nCode, WXWPARAM wParam, WXLPARAM lParam) wxEvtHandler * const handler = win ? win->GetEventHandler() : wxTheApp; - if ( handler && handler->ProcessEvent(event) ) + // Do not let exceptions propagate out of the hook, it's a + // module boundary. + if ( handler && handler->SafelyProcessEvent(event) ) { if ( !event.IsNextEventAllowed() ) {