mirror of
https://github.com/cookiengineer/audacity
synced 2026-04-03 21:07:36 +02:00
Dont delete sample blocks prematurely (#648)
* Revert "AUP3: Don't delete sample blocks prematurely" This reverts commitc1884349d5. * "Don't delete sample blocks prematurely" fixed otherwise... ... and very simply. Problem was that, only for an interactive effect (like Bass and Treble), the save point was created, rolled back, created again, then committed. But (unlike with the non-savepoint commands, even if savepoint is outermost), rolling back a savepoint really just rewinds it without removing it -- therefore the second savepoint was inner, but the first (outer) was never committed, so some changes failed to persist. Solution: add a commit after rollback of savepoint to implement destructor of AutoCommitTransaction. The reversion ofc188434also leaves AutoCommitTransaction as a better RAII style operation. Rollback changes by default -- keep changes only if success is explicitly indicated. * Rename AutoCommitTransaction as TransactionScope... ... More appropriately, since it's now the rollback that is automatic but the commit that must be explicit
This commit is contained in:
@@ -740,7 +740,7 @@ void ProjectManager::OnCloseWindow(wxCloseEvent & event)
|
||||
projectFileIO.SetBypass();
|
||||
|
||||
{
|
||||
AutoCommitTransaction trans(projectFileIO, "Shutdown");
|
||||
TransactionScope trans(projectFileIO, "Shutdown");
|
||||
|
||||
// This can reduce reference counts of sample blocks in the project's
|
||||
// tracks.
|
||||
@@ -748,6 +748,8 @@ void ProjectManager::OnCloseWindow(wxCloseEvent & event)
|
||||
|
||||
// Delete all the tracks to free up memory
|
||||
tracks.Clear();
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
// We're all done with the project file, so close it now
|
||||
|
||||
Reference in New Issue
Block a user