Commit 1bfa6a94 authored by Max Kellermann's avatar Max Kellermann

player: fix race condition during tag update

When a tag is updated, the old tag was freed before the new one was created. Reverse the order to be sure that other threads always see a valid pointer. This still leaves a possible race condition, but it will be addressed later.
parent acf0d141
......@@ -225,11 +225,13 @@ play_chunk(struct song *song, struct music_chunk *chunk,
if (!song_is_file(song)) {
/* always update the tag of remote streams */
struct tag *old_tag = song->tag;
if (song->tag != NULL)
tag_free(song->tag);
song->tag = tag_dup(chunk->tag);
if (old_tag != NULL)
tag_free(old_tag);
/* notify all clients that the tag of the
current song has changed */
idle_add(IDLE_PLAYER);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment