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;
if ( this != &that ) {
AudacityException::operator=( std::move(that) );
if (!moved)
wxAtomicDec( sOutstandingMessages );

View File

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

View File

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

View File

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

View File

@ -23,6 +23,6 @@ wxString NotYetAvailableException::ErrorMessage() const
{
return wxString::Format(
_("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 } {}
NotYetAvailableException(NotYetAvailableException &&that)
: FileException( std::move( that ) ) {}
NotYetAvailableException& operator= (NotYetAvailableException&&) PROHIBITED;
~NotYetAvailableException();
protected:
std::unique_ptr< AudacityException > Move() override;
wxString ErrorMessage() const override;
private:
wxFileName mFileName;
};
#endif