diff options
author | Max Kellermann <max@duempel.org> | 2010-06-19 13:15:42 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-06-19 13:33:39 +0200 |
commit | 442b327582ed506ca872d20e03d9c23bea02a4a2 (patch) | |
tree | d0ddcf1a0796b8d8623c5462a767f5331e38a2e1 /src | |
parent | cff727644d7cc9f2e5c8767896706f1e8d41a767 (diff) | |
download | mpd-442b327582ed506ca872d20e03d9c23bea02a4a2.tar.gz mpd-442b327582ed506ca872d20e03d9c23bea02a4a2.tar.xz mpd-442b327582ed506ca872d20e03d9c23bea02a4a2.zip |
playlist: protect acess to player state in playlist_sync()
Diffstat (limited to '')
-rw-r--r-- | src/playlist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/playlist.c b/src/playlist.c index 99feb28da..8929e417b 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -219,7 +219,12 @@ playlist_sync(struct playlist *playlist) playing anymore; ignore the event */ return; - if (pc_get_state() == PLAYER_STATE_STOP) + player_lock(); + enum player_state pc_state = pc_get_state(); + const struct song *pc_next_song = pc.next_song; + player_unlock(); + + if (pc_state == PLAYER_STATE_STOP) /* the player thread has stopped: check if playback should be restarted with the next song. That can happen if the playlist isn't filling the queue fast @@ -228,7 +233,7 @@ playlist_sync(struct playlist *playlist) else { /* check if the player thread has already started playing the queued song */ - if (pc.next_song == NULL && playlist->queued != -1) + if (pc_next_song == NULL && playlist->queued != -1) playlist_song_started(playlist); /* make sure the queued song is always set (if |