From bf083479d51c66aba194846b000b5b0fd803ad8a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 2 Jul 2016 16:21:20 +0200 Subject: [PATCH 1/2] Make message from wxApp::OnUnhandledException() more clear This message now appears even in the (default) release builds as __WXDEBUG__ is always defined, so it needs to be at least somewhat understandable by normal users, even if it remains primarily targeted at the developers. Also remove __WXDEBUG__ checks in this function, this is a left-over from the pre-3.0 debug mode. --- src/common/appbase.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index a2d7202f40..f8f340f60f 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -673,7 +673,6 @@ void wxAppConsoleBase::CallEventHandler(wxEvtHandler *handler, void wxAppConsoleBase::OnUnhandledException() { -#ifdef __WXDEBUG__ // we're called from an exception handler so we can re-throw the exception // to recover its type wxString what; @@ -685,9 +684,9 @@ void wxAppConsoleBase::OnUnhandledException() catch ( std::exception& e ) { #ifdef wxNO_RTTI - what.Printf("std::exception, what() = \"%s\"", e.what()); + what.Printf("standard exception with message \"%s\"", e.what()); #else - what.Printf("std::exception of type \"%s\", what() = \"%s\"", + what.Printf("standard exception of type \"%s\" with message \"%s\"", typeid(e).name(), e.what()); #endif } @@ -698,9 +697,8 @@ void wxAppConsoleBase::OnUnhandledException() } wxMessageOutputBest().Printf( - "*** Caught unhandled %s; terminating\n", what + "Unhandled %s; terminating\n", what ); -#endif // __WXDEBUG__ } // ---------------------------------------------------------------------------- From 46d36d99c708a9bd2653f256335a51233f8fa590 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 2 Jul 2016 16:25:43 +0200 Subject: [PATCH 2/2] Don't give misleading message for unhandled exceptions in a thread The application doesn't necessarily terminate when a thread dies due to an unhandled exception, even though it will often crash later. --- src/common/appbase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index f8f340f60f..63512ccd38 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -697,7 +697,9 @@ void wxAppConsoleBase::OnUnhandledException() } wxMessageOutputBest().Printf( - "Unhandled %s; terminating\n", what + "Unhandled %s; terminating %s.\n", + what, + wxIsMainThread() ? "the application" : "the thread in which it happened" ); }