Make wxLogGui::Flush() exception safe.
Don't suspend the logs forever if showing the log dialog throws an exception (this is unlikely but may happen when running unattended GUI tests or using the dialog hooks throwing exceptions for any other purpose).
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include "wx/collpane.h"
|
||||
#include "wx/arrstr.h"
|
||||
#include "wx/msgout.h"
|
||||
#include "wx/scopeguard.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// for OutputDebugString()
|
||||
@@ -309,6 +310,10 @@ void wxLogGui::Flush()
|
||||
// showing right now: nested modal dialogs make for really bad UI!
|
||||
Suspend();
|
||||
|
||||
// and ensure that we allow showing the log again afterwards, even if an
|
||||
// exception is thrown
|
||||
wxON_BLOCK_EXIT0(wxLog::Resume);
|
||||
|
||||
if ( nMsgCount == 1 )
|
||||
{
|
||||
// make a copy before calling Clear()
|
||||
@@ -331,9 +336,6 @@ void wxLogGui::Flush()
|
||||
|
||||
DoShowMultipleLogMessages(messages, severities, times, title, style);
|
||||
}
|
||||
|
||||
// allow flushing the logs again
|
||||
Resume();
|
||||
}
|
||||
|
||||
// log all kinds of messages
|
||||
|
Reference in New Issue
Block a user