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

AUP3: Don't delete sample blocks prematurely

The wrong sample blocks would be deleted at close in step 6:

1) New Project
2) Save and name
3) Import one stereo MP3 (about 6 minutes)
4) Save, close and re-open
5) Apply Bass and Treble to the track using real-time preview
6) Save, close and re-open
7) Message Failed to retrieve sample block
This commit is contained in:
Leland Lucius 2020-07-25 20:03:23 -05:00
parent 03762d0ca3
commit c1884349d5
4 changed files with 4 additions and 11 deletions

View File

@ -2162,7 +2162,7 @@ AutoCommitTransaction::~AutoCommitTransaction()
{ {
if (mInTrans) if (mInTrans)
{ {
if (!mIO.TransactionRollback(mName)) if (!mIO.TransactionCommit(mName))
{ {
// Do not throw from a destructor! // Do not throw from a destructor!
// This has to be a no-fail cleanup that does the best that it can. // This has to be a no-fail cleanup that does the best that it can.
@ -2170,13 +2170,13 @@ AutoCommitTransaction::~AutoCommitTransaction()
} }
} }
bool AutoCommitTransaction::Commit() bool AutoCommitTransaction::Rollback()
{ {
if ( !mInTrans ) if ( !mInTrans )
// Misuse of this class // Misuse of this class
THROW_INCONSISTENCY_EXCEPTION; THROW_INCONSISTENCY_EXCEPTION;
mInTrans = !mIO.TransactionCommit(mName); mInTrans = !mIO.TransactionRollback(mName);
return mInTrans; return mInTrans;
} }

View File

@ -221,8 +221,6 @@ private:
}; };
// Make a savepoint (a transaction, possibly nested) with the given name; // Make a savepoint (a transaction, possibly nested) with the given name;
// roll it back at destruction time, unless an explicit Commit() happened first.
// Commit() must not be called again after one successful call.
// An exception is thrown from the constructor if the transaction cannot open. // An exception is thrown from the constructor if the transaction cannot open.
class AutoCommitTransaction class AutoCommitTransaction
{ {
@ -230,7 +228,7 @@ public:
AutoCommitTransaction(ProjectFileIO &projectFileIO, const char *name); AutoCommitTransaction(ProjectFileIO &projectFileIO, const char *name);
~AutoCommitTransaction(); ~AutoCommitTransaction();
bool Commit(); bool Rollback();
private: private:
ProjectFileIO &mIO; ProjectFileIO &mIO;

View File

@ -748,8 +748,6 @@ void ProjectManager::OnCloseWindow(wxCloseEvent & event)
// Delete all the tracks to free up memory // Delete all the tracks to free up memory
tracks.Clear(); tracks.Clear();
trans.Commit();
} }
// We're all done with the project file, so close it now // We're all done with the project file, so close it now

View File

@ -1251,9 +1251,6 @@ bool Effect::DoEffect(double projectRate,
// LastUsedDuration may have been modified by Preview. // LastUsedDuration may have been modified by Preview.
SetDuration(oldDuration); SetDuration(oldDuration);
} }
else
trans.Commit();
End(); End();
ReplaceProcessedTracks( false ); ReplaceProcessedTracks( false );
} ); } );