From a37f4e194dc774a064be6cd8d4bc5db2c0cc87dd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 22 Sep 2023 18:29:11 +0200 Subject: [PATCH] Remove redundant RegionGroupRetainer Track::use_captured_midi_sources is called from use_captured_sources(). which is only called from DiskWriter::transport_stopped_wallclock(), which is only called from Session::non_realtime_stop(). --- libs/ardour/disk_writer.cc | 3 --- libs/ardour/session_transport.cc | 14 ++++++++------ libs/ardour/track.cc | 3 --- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 541f5ba73a..0c8d197480 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -1189,9 +1189,6 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo uint32_t n = 0; bool mark_write_completed = false; - /* finishing a capture will potentially create a lot of regions; we want them all assigned to the same region-group */ - Region::RegionGroupRetainer rgr; - finish_capture (c); /* butler is already stopped, but there may be work to do diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 7e963cd8d7..681dfb7a8c 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1396,13 +1396,15 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished, bool will_ _state_of_the_state = StateOfTheState (_state_of_the_state | InCleanup); } - /* finishing a capture will potentially create a lot of regions; we want them all assigned to the same region-group */ - Region::RegionGroupRetainer rgr; + { + /* finishing a capture will potentially create a lot of regions; we want them all assigned to the same region-group */ + Region::RegionGroupRetainer rgr; - for (auto const& i : *rl) { - std::shared_ptr tr = std::dynamic_pointer_cast (i); - if (tr) { - tr->transport_stopped_wallclock (*now, xnow, abort); + for (auto const& i : *rl) { + std::shared_ptr tr = std::dynamic_pointer_cast (i); + if (tr) { + tr->transport_stopped_wallclock (*now, xnow, abort); + } } } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index fcf7a2221b..7ac68ba078 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -962,9 +962,6 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture return; } - /* all regions created from a recording pass should share the same group-id */ - Region::RegionGroupRetainer rgr; - RecordMode rmode = _session.config.get_record_mode (); samplecnt_t total_capture = 0;