1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-26 07:53:42 +02:00

Avoid long repetitions of message boxes for opening corrupt project

This commit is contained in:
Paul Licameli
2017-10-20 23:22:07 -04:00
parent 404eca84c8
commit e4b9b7b505
4 changed files with 10 additions and 4 deletions

View File

@@ -13,7 +13,11 @@ wxAtomicInt sOutstandingMessages {};
MessageBoxException::MessageBoxException( const wxString &caption_ ) MessageBoxException::MessageBoxException( const wxString &caption_ )
: caption{ caption_ } : caption{ caption_ }
{ {
wxAtomicInc( sOutstandingMessages ); if (!caption.empty())
wxAtomicInc( sOutstandingMessages );
else
// invalidate me
moved = true;
} }
// The class needs a copy constructor to be throwable // The class needs a copy constructor to be throwable

View File

@@ -55,6 +55,7 @@ class MessageBoxException /* not final */ : public AudacityException
void DelayedHandlerAction() override; void DelayedHandlerAction() override;
protected: protected:
// If default-constructed with empty caption, it makes no message box.
explicit MessageBoxException( const wxString &caption = wxString{} ); explicit MessageBoxException( const wxString &caption = wxString{} );
~MessageBoxException() override; ~MessageBoxException() override;
@@ -74,7 +75,7 @@ class SimpleMessageBoxException /* not final */ : public MessageBoxException
{ {
public: public:
explicit SimpleMessageBoxException( const wxString &message_, explicit SimpleMessageBoxException( const wxString &message_,
const wxString &caption = wxString{} ) const wxString &caption = _("Message") )
: MessageBoxException{ caption } : MessageBoxException{ caption }
, message{ message_ } , message{ message_ }
{} {}

View File

@@ -19,7 +19,7 @@ public:
explicit FileException explicit FileException
( Cause cause_, const wxFileName &fileName_, ( Cause cause_, const wxFileName &fileName_,
const wxString &caption = wxString{}, const wxString &caption = _("File Error"),
const wxFileName &renameTarget_ = {}) const wxFileName &renameTarget_ = {})
: MessageBoxException{ caption } : MessageBoxException{ caption }
, cause{ cause_ }, fileName{ fileName_ }, renameTarget{ renameTarget_ } , cause{ cause_ }, fileName{ fileName_ }, renameTarget{ renameTarget_ }

View File

@@ -22,7 +22,8 @@ public:
explicit InconsistencyException explicit InconsistencyException
( const char *fn, const char *f, unsigned l ) ( const char *fn, const char *f, unsigned l )
: func { fn }, file { f }, line { l } : MessageBoxException{ _("Internal Error") }
, func { fn }, file { f }, line { l }
{} {}
InconsistencyException(InconsistencyException&& that) InconsistencyException(InconsistencyException&& that)