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
This commit is contained in:
Vadim Zeitlin 2014-08-16 00:24:56 +00:00
parent d0406f4606
commit 0223c10048

View File

@ -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;
}