diff options
author | Max Kellermann <max@duempel.org> | 2009-11-02 17:02:05 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-02 17:02:05 +0100 |
commit | 93d8f9f00e838b4b0054ea6487d8810bfa60628d (patch) | |
tree | 5d19f58485b71adeac1d591b702cb299b83275cd | |
parent | d1742a2330af968c8ca453855ad0604f4998428b (diff) | |
download | mpd-93d8f9f00e838b4b0054ea6487d8810bfa60628d.tar.gz mpd-93d8f9f00e838b4b0054ea6487d8810bfa60628d.tar.xz mpd-93d8f9f00e838b4b0054ea6487d8810bfa60628d.zip |
player_control: lock player before setting seek parameters
These parameters must be protected with a mutex, too. Wrap everything
inside player_lock()/player_unlock(), and use player_command_locked()
instead of player_command().
-rw-r--r-- | src/player_control.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/player_control.c b/src/player_control.c index ab162ef26..42dc9e1c0 100644 --- a/src/player_control.c +++ b/src/player_control.c @@ -258,8 +258,10 @@ pc_enqueue_song(struct song *song) assert(song != NULL); assert(pc.next_song == NULL); + player_lock(); pc.next_song = song; - player_command(PLAYER_COMMAND_QUEUE); + player_command_locked(PLAYER_COMMAND_QUEUE); + player_unlock(); } bool @@ -270,9 +272,11 @@ pc_seek(struct song *song, float seek_time) if (pc.state == PLAYER_STATE_STOP) return false; + player_lock(); pc.next_song = song; pc.seek_where = seek_time; - player_command(PLAYER_COMMAND_SEEK); + player_command_locked(PLAYER_COMMAND_SEEK); + player_unlock(); assert(pc.next_song == NULL); |