13
0

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.
This commit is contained in:
Robin Gareus 2023-05-29 18:04:27 +02:00
parent 5dd35ff86a
commit 3c17721eff
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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<ARDOUR::Source> 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<ARDOUR::Region> 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;
}
}
}