1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Fix move constructors and assignments of AudacityException classes

This commit is contained in:
Paul Licameli 2017-03-21 12:45:04 -04:00
parent e9a4fc8354
commit 7927fe065f
6 changed files with 19 additions and 6 deletions

View File

@ -31,6 +31,7 @@ MessageBoxException &MessageBoxException::operator = ( MessageBoxException &&tha
{ {
caption = that.caption; caption = that.caption;
if ( this != &that ) { if ( this != &that ) {
AudacityException::operator=( std::move(that) );
if (!moved) if (!moved)
wxAtomicDec( sOutstandingMessages ); wxAtomicDec( sOutstandingMessages );

View File

@ -27,8 +27,13 @@ public:
FileException(FileException&& that) FileException(FileException&& that)
: MessageBoxException(std::move(that)) : MessageBoxException(std::move(that))
, cause{ that.cause }
, fileName{ that.fileName }
, renameTarget{ that.renameTarget }
{} {}
FileException& operator= (FileException&&) PROHIBITED;
~FileException() override; ~FileException() override;
protected: protected:

View File

@ -27,11 +27,18 @@ public:
InconsistencyException(InconsistencyException&& that) InconsistencyException(InconsistencyException&& that)
: MessageBoxException(std::move(that)) : MessageBoxException(std::move(that))
, func{ that.func }
, file{ that.file }
, line{ that.line }
{} {}
InconsistencyException &operator = (InconsistencyException &&that) InconsistencyException &operator = (InconsistencyException &&that)
{ {
if (this != &that) if (this != &that) {
operator= (std::move(that)); MessageBoxException::operator= (std::move(that));
func = that.func;
file = that.file;
line = that.line;
}
return *this; return *this;
} }

View File

@ -25,6 +25,8 @@ public:
: AudacityException{ std::move( that ) } : AudacityException{ std::move( that ) }
{} {}
UserException& operator= (UserException&&) PROHIBITED;
~UserException() override; ~UserException() override;
void DelayedHandlerAction() override; void DelayedHandlerAction() override;

View File

@ -23,6 +23,6 @@ wxString NotYetAvailableException::ErrorMessage() const
{ {
return wxString::Format( return wxString::Format(
_("This operation cannot be done until importation of %s completes."), _("This operation cannot be done until importation of %s completes."),
mFileName.GetFullName() fileName.GetFullName()
); );
} }

View File

@ -21,14 +21,12 @@ public:
: FileException{ Cause::Read, fileName } {} : FileException{ Cause::Read, fileName } {}
NotYetAvailableException(NotYetAvailableException &&that) NotYetAvailableException(NotYetAvailableException &&that)
: FileException( std::move( that ) ) {} : FileException( std::move( that ) ) {}
NotYetAvailableException& operator= (NotYetAvailableException&&) PROHIBITED;
~NotYetAvailableException(); ~NotYetAvailableException();
protected: protected:
std::unique_ptr< AudacityException > Move() override; std::unique_ptr< AudacityException > Move() override;
wxString ErrorMessage() const override; wxString ErrorMessage() const override;
private:
wxFileName mFileName;
}; };
#endif #endif