From ad5d355fb51996009363540bea0de0010a4696e8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 4 Jun 2023 21:26:41 +0200 Subject: [PATCH] Fix remove_source assert() With empty MIDI regions it can happen that the GUI still retains a reference (rec_regions) --- libs/ardour/session.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index d8dd4c76a1..7a9f9fb993 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -4657,7 +4657,6 @@ Session::remove_source (std::weak_ptr src, bool drop_references) */ _history.clear(); } - assert (!source->used ()); if (source->empty ()) { /* No need to save when empty sources are removed. @@ -4667,6 +4666,8 @@ Session::remove_source (std::weak_ptr src, bool drop_references) return; } + assert (!source->used ()); + if (!in_cleanup () && !loading ()) { /* save state so we don't end up with a session file * referring to non-existent sources.