From 3c17721eff22a4075cb6bf5afb108127c085302c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 29 May 2023 18:04:27 +0200 Subject: [PATCH] Fix SourceListBase::remove_source * It was never called because SourceListBase::set_session subscribed to the signal just before SessionHandle::set_session dropped _session_connections * remove_source() only checked the first source of the whole-file region, not all sources of a multi-channel region. Stereo regions with mono sources are now properly cleaned up. --- gtk2_ardour/source_list_base.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/source_list_base.cc b/gtk2_ardour/source_list_base.cc index 56aa4ccf42..3b430dc2e0 100644 --- a/gtk2_ardour/source_list_base.cc +++ b/gtk2_ardour/source_list_base.cc @@ -33,10 +33,10 @@ SourceListBase::SourceListBase () void SourceListBase::set_session (ARDOUR::Session* s) { + RegionListBase::set_session (s); if (s) { s->SourceRemoved.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&SourceListBase::remove_weak_source, this, _1), gui_context ()); } - RegionListBase::set_session (s); } void @@ -53,14 +53,15 @@ SourceListBase::remove_source (std::shared_ptr source) { TreeModel::iterator i; TreeModel::Children rows = _model->children (); - for (i = rows.begin (); i != rows.end (); ++i) { + for (i = rows.begin (); i != rows.end ();) { std::shared_ptr rr = (*i)[_columns.region]; - if (rr->source () == source) { + if (rr->uses_source (source)) { RegionRowMap::iterator map_it = region_row_map.find (rr); assert (map_it != region_row_map.end () && i == map_it->second); region_row_map.erase (map_it); - _model->erase (i); - break; + i = _model->erase (i); + } else { + ++i; } } }