Bug2579: Don't corrupt project after compact the exit without save...

... also may improve compaction by clearing mLastSavedTracks first
This commit is contained in:
Paul Licameli 2020-11-17 17:15:19 -05:00
parent ea76b7c9f7
commit 8ac1cb75aa
1 changed files with 4 additions and 1 deletions

View File

@ -1269,6 +1269,9 @@ void ProjectFileManager::Compact()
if (&mProject == clipboard.Project().lock().get())
clipboard.Clear();
// This may also decrease some reference counts on blocks
mLastSavedTracks.reset();
// Refresh the before space usage since it may have changed due to the
// above actions.
auto before = wxFileName::GetSize(projectFileIO.GetFileName());
@ -1286,5 +1289,5 @@ void ProjectFileManager::Compact()
}
}
currentTracks.reset();
mLastSavedTracks = currentTracks;
}