when removing Stripables from CoreSelection by ID, be sure to remove all possible...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 8 May 2017 09:36:04 +0000 (10:36 +0100)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 8 May 2017 09:41:12 +0000 (10:41 +0100)
A Stripable may have itself plus zero-to-N automation controls in
CoreSelection.

libs/ardour/selection.cc

index 876056c3da81a7b55cfb3cebc46f7ffe859f1b86..6775759fc974bcae906019b34187f28e8c6caf11 100644 (file)
@@ -249,10 +249,14 @@ CoreSelection::remove_stripable_by_id (PBD::ID const & id)
 {
        Glib::Threads::RWLock::WriterLock lm (_lock);
 
-       for (SelectedStripables::iterator x = _stripables.begin(); x != _stripables.end(); ++x) {
+       for (SelectedStripables::iterator x = _stripables.begin(); x != _stripables.end(); ) {
                if ((*x).stripable == id) {
-                       _stripables.erase (x);
-                       return;
+                       x = _stripables.erase (x);
+                       /* keep going because there may be more than 1 pair of
+                          stripable/automation-control in the selection.
+                       */
+               } else {
+                       ++x;
                }
        }
 }