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:
@@ -160,6 +160,21 @@ const TrackSnapshot* ViewModeModel::snapshot(const std::string& guid) const {
|
||||
return it == snapshots_.end() ? nullptr : &it->second;
|
||||
}
|
||||
|
||||
std::size_t ViewModeModel::reconcile(const std::set<std::string>& liveGuids) {
|
||||
// Prune snapshots for GUIDs the project no longer contains (see header for the
|
||||
// deliberate snapshot-yes / membership-no asymmetry and the undo-delete rationale).
|
||||
std::size_t removed = 0;
|
||||
for (auto it = snapshots_.begin(); it != snapshots_.end();) {
|
||||
if (liveGuids.count(it->first) == 0) {
|
||||
it = snapshots_.erase(it);
|
||||
++removed;
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
bool ViewModeModel::leafBelongsToMode(const std::string& guid, const std::string& modeId) const {
|
||||
const Membership* m = membership_.query(guid);
|
||||
if (!m) return modeId == kArrangeModeId; // untagged ⇒ Arrange default
|
||||
|
||||
Reference in New Issue
Block a user