From 61d11347b6f72f1ad3b4f161bf368e8113d40751 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 19 May 2020 18:04:40 +0200 Subject: Remove implicit saves when removing empty sources This fixes an implicit save when importing files. The Track's disk-reader is initially created with an empty source which is later replaced and dropped: ARDOUR::Session::save_state ARDOUR::Session::remove_source PBD::Destructible::drop_references ARDOUR::DiskWriter::reset_write_sources ARDOUR::DiskWriter::set_write_source_name ARDOUR::Track::set_name Editor::finish_bringing_in_material --- libs/ardour/session.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index c3672b0d39..6a99053f1f 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -4456,15 +4456,23 @@ Session::remove_source (boost::weak_ptr src) if ((i = sources.find (source->id())) != sources.end()) { sources.erase (i); SourceRemoved (src); /* EMIT SIGNAL */ + } else { + return; } } - if (!in_cleanup () && !loading ()) { + if (source->empty ()) { + /* No need to save when empty sources are removed. + * This is likely due to disk-writer initial dummies + * where files don't even exist on disk. + */ + return; + } + if (!in_cleanup () && !loading ()) { /* save state so we don't end up with a session file * referring to non-existent sources. */ - save_state (); } } -- cgit v1.2.3