From dcc0f1cb17724b41b45f9dee5c1a29ceb6af5872 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 12 May 2021 19:22:35 +0200 Subject: [PATCH] Fix playlist edit after edit race After an edit option the playlist is thawed and triggers the butler thread (SessionEvent::Overwrite) to re-read the playlist. If another edit operation is started the butler may reads a region using the region's new position, but the playlist's old range. See also 4db1c02bd1a0e4da9efd725cd8fb098ba7c4abe5 --- libs/ardour/playlist.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 98a70d0518..8b536a30d5 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -449,6 +449,10 @@ Playlist::end_undo () void Playlist::freeze () { + /* flush any ongoing reads, paricularly AudioPlaylist::read(), + * before beginning to modify the playlist. + */ + RegionWriteLock rlock (this); delay_notifications (); g_atomic_int_inc (&ignore_state_changes); }