diff --git a/include/wx/log.h b/include/wx/log.h index f3552e9724..b6d3ecc209 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -1459,7 +1459,7 @@ inline void wxLogNop() { } // wxLogFatalError helper: show the (fatal) error to the user in a safe way, // i.e. without using wxMessageBox() for example because it could crash -void WXDLLIMPEXP_BASE +bool WXDLLIMPEXP_BASE wxSafeShowMessage(const wxString& title, const wxString& text); // ---------------------------------------------------------------------------- diff --git a/interface/wx/log.h b/interface/wx/log.h index f875709dba..62f46a2e5c 100644 --- a/interface/wx/log.h +++ b/interface/wx/log.h @@ -1268,12 +1268,17 @@ public: message string. @param text The text to show to the user. + @return + @true If a message box was actually shown or @false if the message was + logged to the console because there is no safe to show it currently + (the return value is only available since wxWidgets 3.1.5, the function + doesn't return anything in the previous versions). @see wxLogFatalError() @header{wx/log.h} */ -void wxSafeShowMessage(const wxString& title, const wxString& text); +bool wxSafeShowMessage(const wxString& title, const wxString& text); /** Returns the error code from the last system call. This function uses diff --git a/src/common/log.cpp b/src/common/log.cpp index c5ab359fd0..ee11051613 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -180,13 +180,17 @@ private: // helper global functions // ---------------------------------------------------------------------------- -void wxSafeShowMessage(const wxString& title, const wxString& text) +bool wxSafeShowMessage(const wxString& title, const wxString& text) { if ( !wxApp::GetValidTraits().SafeMessageBox(text, title) ) { wxFprintf(stderr, wxS("%s: %s\n"), title.c_str(), text.c_str()); fflush(stderr); + return false; } + + // Message box actually shown. + return true; } // ----------------------------------------------------------------------------