From b32ce8ab210700fe3de23353b6ff504b70e5ef7f Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 22 Nov 2020 12:09:13 -0500 Subject: [PATCH] Fix assertions on project close about mis-estimated block count --- src/UndoManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/UndoManager.cpp b/src/UndoManager.cpp index 1b6c7e50b..979253e43 100644 --- a/src/UndoManager.cpp +++ b/src/UndoManager.cpp @@ -185,7 +185,10 @@ size_t UndoManager::EstimateRemovedBlocks(size_t begin, size_t end) // Collect ids that won't survive (and are not negative pseudo ids) SampleBlockIDSet seen, mayDelete; - std::for_each( first + begin, first + end, [&](const auto &p){ + for( auto ii = begin; ii < end; ++ii) { + if (ii == saved) + continue; + auto &p = *(first + ii); auto &tracks = *p->state.tracks; InspectBlocks(tracks, [&]( const SampleBlock &block ){ auto id = block.GetBlockID(); @@ -193,7 +196,7 @@ size_t UndoManager::EstimateRemovedBlocks(size_t begin, size_t end) mayDelete.insert( id ); }, &seen); - } ); + } return mayDelete.size(); }