From 5a0531df019ab2217c14f5b016e1afe3913d895f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 31 May 2023 01:17:19 +0200 Subject: [PATCH] Sync `all_regions` after region removal The eventual goal is to keep the set of used regions in sync, and allow to remove explicit calls to `sync_all_regions_with_regions`. This prevents `all_regions` to retain a reference to a region that has been destroyed. --- libs/ardour/playlist.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 303ef9186a..4897ab5640 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -853,6 +853,20 @@ Playlist::remove_region_internal (std::shared_ptr region, ThawList& thaw } } +#if 0 + for (set >::iterator x = all_regions.begin(); x != all_regions.end(); ++x) { + if ((*x) == region) { + all_regions.erase (x); + break; + } + } +#else /* sync_all_regions_with_regions */ + all_regions.clear (); + for (auto const& r: regions) { + all_regions.insert (r); + } +#endif + return -1; }