Reconcile orphaned Design View snapshots on track delete
Add ViewModeModel::reconcile(liveGuids) to prune snapshots of deleted tracks; wire it into applyMode before planning. Keep membership so undo-delete (same GUID) preserves the Design tag.
This commit is contained in:
@@ -144,6 +144,16 @@ bool applyMode(ViewModeModel& model, const std::string& targetModeId, ReaProject
|
||||
std::vector<TrackFolderEntry> entries = readFolderEntries(proj, handleByGuid);
|
||||
FolderTree tree = buildFolderTree(entries);
|
||||
|
||||
// Reconcile orphaned model state BEFORE planning: prune snapshots whose track was
|
||||
// deleted from the project (its GUID no longer appears in the live enumeration).
|
||||
// handleByGuid holds every currently-enumerated track GUID, so its keys are the
|
||||
// authoritative live set. Membership is intentionally NOT pruned (undo-delete
|
||||
// restores the same GUID — see ViewModeModel::reconcile). Because reapply-on-load
|
||||
// routes through applyMode, this also reconciles on project open.
|
||||
std::set<std::string> liveGuids;
|
||||
for (const auto& kv : handleByGuid) liveGuids.insert(kv.first);
|
||||
model.reconcile(liveGuids);
|
||||
|
||||
TogglePlan plan = model.planToggle(tree, targetModeId);
|
||||
|
||||
Undo_BeginBlock2(proj);
|
||||
|
||||
Reference in New Issue
Block a user