From f3ee7fdf880a7179b823f0e9fbf19c5db0823fbc Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 31 May 2023 15:46:59 +0200 Subject: [PATCH] Fix crash when trying to undo region operations across source deletion Record, move recorded region(s), delete the recorded source, undo. Undo would undo the region-move, of a region that no longer exists and has no source. --- libs/ardour/session.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2d16486418..d8dd4c76a1 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -4649,11 +4649,13 @@ Session::remove_source (std::weak_ptr src, bool drop_references) SourceRemoved (src); /* EMIT SIGNAL */ if (drop_references) { - /* It would not matter to recurse here, the - * source was already removed from the sources. - * But there is no need to take the source_lock again. - */ + printf ("Source->drop_references!\n"); source->drop_references (); + /* Removing a Source cannot be undone. + * We need to clear all undo commands that reference the + * removed source - or just clear all of the undo history. + */ + _history.clear(); } assert (!source->used ());