From 4647dd6b416cf518f6c15e318aaf2321a768c27b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 20 Nov 2023 19:11:30 -0700 Subject: [PATCH] fix crash when freezing a track with > 1 region (#9539) deleting regionviews changed the region selection, but the regionview ptr had not been removed from the RegionViewList. The selection change signal caused an iteration over the list, and manipulated the deleted regionview. --- gtk2_ardour/streamview.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index cbd3e182a8..eda605d3e5 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -227,14 +227,12 @@ StreamView::remove_region_view (std::weak_ptr weak_r) void StreamView::undisplay_track () { - for (RegionViewList::iterator i = region_views.begin(); i != region_views.end() ; ) { - RegionViewList::iterator next = i; - ++next; - delete *i; - i = next; - } + RegionViewList copy (region_views); + region_views.clear (); - region_views.clear(); + for (auto const & rv : copy) { + delete rv; + } } void