From 0223c10048cfe8fa1d08eec87b545c6d42eb3c89 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 16 Aug 2014 00:24:56 +0000 Subject: [PATCH] Don't exit event loop when exception occurs inside Yield(). If an unhandled exception occurs in an event handler called from Yield(), don't exit the current event loop which can continue running after handling this exception in the code calling Yield(). Closes #16419. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/event.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index b41f31cb8c..16a8b98b63 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1637,8 +1637,12 @@ bool wxEvtHandler::SafelyProcessEvent(wxEvent& event) { // OnExceptionInMainLoop() threw, possibly rethrowing the same // exception again: very good, but we still need Exit() to - // be called - if ( loop ) + // be called, unless we're not called from the loop directly but + // from Yield(), in which case we shouldn't exit the loop but just + // unwind to the point where Yield() is called where the exception + // might be handled -- and if not, then it will unwind further and + // exit the loop when it is caught. + if ( loop && !loop->IsYielding() ) loop->Exit(); throw; }