Skip to content

Commit

Permalink
Make wxLogGui::Flush() exception safe.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
vadz committed Mar 9, 2015
1 parent 7048b7e commit bcacb44
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/generic/logg.cpp
Expand Up @@ -51,6 +51,7 @@
#include "wx/collpane.h"
#include "wx/arrstr.h"
#include "wx/msgout.h"
#include "wx/scopeguard.h"

#ifdef __WXMSW__
// for OutputDebugString()
Expand Down Expand Up @@ -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()
Expand All @@ -331,9 +336,6 @@ void wxLogGui::Flush()

DoShowMultipleLogMessages(messages, severities, times, title, style);
}

// allow flushing the logs again
Resume();
}

// log all kinds of messages
Expand Down

0 comments on commit bcacb44

Please sign in to comment.