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

Bug2605: Don't leave orphans in original project after save-as

This commit is contained in:
Paul Licameli 2020-12-02 13:00:44 -05:00
parent 47bdf27f2d
commit b6ce29d234

View File

@ -2121,6 +2121,16 @@ bool ProjectFileIO::SaveProject(
// Autosave no longer needed in original project file
AutoSaveDelete();
if (lastSaved) {
// Bug2605: Be sure not to save orphan blocks
bool recovered = mRecovered;
SampleBlockIDSet blockids;
InspectBlocks( *lastSaved, {}, &blockids );
DeleteBlocks(blockids, true);
// Don't set mRecovered if any were deleted
mRecovered = recovered;
}
// Try to compact the original project file
auto empty = TrackList::Create(&mProject);
Compact( { lastSaved ? lastSaved : empty.get() } );