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 4db1c02bd1
This commit is contained in:
Robin Gareus 2021-05-12 19:22:35 +02:00
parent bdaca1d783
commit dcc0f1cb17
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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);
}