summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-02-25 15:17:44 +0100
committerRobin Gareus <robin@gareus.org>2020-02-25 16:16:59 +0100
commitfc91c217d137ed5f05da76c198c3535a08ff5e6b (patch)
tree50edb205012ffe42eda4dbf10fa0ed7158e8e363
parent8e1a2d7caa4f465a64834e553f1f3d7c52f6aea0 (diff)
Notify owners when removing regions during cleanup
Previously the region was only removed from the Session's region_map without sending notifications.
-rw-r--r--libs/ardour/region_factory.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index 80a09b8a5c..52b656e79f 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -663,19 +663,17 @@ void
RegionFactory::remove_regions_using_source (boost::shared_ptr<Source> src)
{
Glib::Threads::Mutex::Lock lm (region_map_lock);
-
- RegionMap::iterator i = region_map.begin();
- while (i != region_map.end()) {
-
- RegionMap::iterator j = i;
- ++j;
-
+ RegionList remove_regions;
+ for (RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
if (i->second->uses_source (src)) {
- remove_from_region_name_map (i->second->name ());
- region_map.erase (i);
- }
+ remove_regions.push_back (i->second);
+ }
+ }
+ lm.release ();
- i = j;
+ /* this will call RegionFactory::map_remove () */
+ for (RegionList::iterator i = remove_regions.begin(); i != remove_regions.end(); ++i) {
+ (*i)->drop_references ();
}
}