From bb50925998414229fb00c2c3c6d6b811c2e614d7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 15 Mar 2021 21:28:52 +0100 Subject: [PATCH] Prevent leaking "recorder:" into the file-name This is safeguard. It should not happen since _write_source_name once Track::set_name () sets this unconditionally. --- libs/ardour/ardour/disk_writer.h | 8 +------- libs/ardour/disk_writer.cc | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h index 0565efe796..3c8d23d451 100644 --- a/libs/ardour/ardour/disk_writer.h +++ b/libs/ardour/ardour/disk_writer.h @@ -58,13 +58,7 @@ public: bool set_write_source_name (const std::string& str); - std::string write_source_name () const { - if (_write_source_name.empty ()) { - return name (); - } else { - return _write_source_name; - } - } + std::string write_source_name () const; boost::shared_ptr audio_write_source (uint32_t n = 0) { boost::shared_ptr c = channels.reader (); diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 3106d5c3aa..86961a4112 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -129,6 +129,20 @@ DiskWriter::set_write_source_name (string const & str) return true; } +std::string +DiskWriter::write_source_name () const +{ + if (!_write_source_name.empty ()) { + return _write_source_name; + } + + std::string const& n (name ()); + if (n.find (X_("recorder:")) == 0 && n.size () > 9) { + return n.substr (9); + } + return n; +} + void DiskWriter::check_record_status (samplepos_t transport_sample, double speed, bool can_record) {