From 2c1eaff476156d9d3c7f72396caccca730067d53 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sat, 10 Oct 2020 15:30:28 +0200 Subject: [PATCH] improvement in order of delete in selection (for better history of delete) --- Mixer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Mixer.cpp b/Mixer.cpp index a1b55ec..a2556be 100644 --- a/Mixer.cpp +++ b/Mixer.cpp @@ -468,8 +468,21 @@ void Mixer::uncover(Source *s) void Mixer::deleteSelection() { + // get clones first : this way we store the history of deletion in the right order + SourceList selection_clones_; + for ( auto sit = selection().begin(); sit != selection().end(); sit++ ) { + CloneSource *clone = dynamic_cast(*sit); + if (clone) + selection_clones_.push_back(clone); + } + // delete all clones + while ( !selection_clones_.empty() ) { + deleteSource( selection_clones_.front()); + selection_clones_.pop_front(); + } + // empty the selection while ( !selection().empty() ) - deleteSource( selection().front()); + deleteSource( selection().front()); // this also remove element from selection() }