From 26eed327adaac80ee112ee133caf40948091d582 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 6 Oct 2023 17:07:44 -0600 Subject: [PATCH] amend 405574184 with correct lock scope and do not hold state --- libs/ardour/playlist.cc | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 6b7d41ed13..777435e90b 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1634,24 +1634,23 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, std::shared } if (what_changed.contains (Properties::length)) { - /* remove it from the list then add it back in - * the right place again. - */ - - RegionSortByPosition cmp; - - RegionList::iterator i = find (regions.begin (), regions.end (), region); - - if (i == regions.end ()) { - /* the region bounds are being modified but its not currently - * in the region list. we will use its bounds correctly when/if - * it is added - */ - return; - } - { - RegionWriteLock rl (this); + /* remove it from the list then add it back in + * the right place again. + */ + + RegionWriteLock rl (this, false); + RegionSortByPosition cmp; + + RegionList::iterator i = find (regions.begin (), regions.end (), region); + + if (i == regions.end ()) { + /* the region bounds are being modified but its not currently + * in the region list. we will use its bounds correctly when/if + * it is added + */ + return; + } regions.erase (i); regions.insert (upper_bound (regions.begin (), regions.end (), region, cmp), region);