diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2016-04-14 16:21:34 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2016-04-14 16:25:13 +0200 |
commit | 0ec2df77a72edde7b65a4ac8e7ffff4470120a51 (patch) | |
tree | f42ccee095dead476f58700991de24ba00e07177 /src/ui_act.c | |
parent | 8c06a59a34b5d9bba277a50198fe2dd50d832da3 (diff) | |
download | pianobar-0ec2df77a72edde7b65a4ac8e7ffff4470120a51.tar.gz pianobar-0ec2df77a72edde7b65a4ac8e7ffff4470120a51.tar.bz2 pianobar-0ec2df77a72edde7b65a4ac8e7ffff4470120a51.zip |
Fix songfinish event when changing stations
The event did not contain any song data (title, artist, …), because the
playlist was destroyed by the ui command. Now the actual station switch
is deferred by introducing nextStation and letting the main loop handle
it.
Fixes issue #584.
Diffstat (limited to 'src/ui_act.c')
-rw-r--r-- | src/ui_act.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ui_act.c b/src/ui_act.c index e8452e6..e1dbfc0 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -236,10 +236,14 @@ BarUiActCallback(BarUiActDeleteStation) { if (BarUiActDefaultPianoCall (PIANO_REQUEST_DELETE_STATION, selStation) && selStation == app->curStation) { BarUiDoSkipSong (&app->player); - PianoDestroyPlaylist (PianoListNextP (app->playlist)); - app->playlist->head.next = NULL; - BarUiHistoryPrepend (app, app->playlist); - app->playlist = NULL; + if (app->playlist != NULL) { + /* drain playlist */ + PianoDestroyPlaylist (PianoListNextP (app->playlist)); + app->playlist->head.next = NULL; + } + app->nextStation = NULL; + /* XXX: usually we shoudn’t touch cur*, but DELETE_STATION destroys + * station struct */ app->curStation = NULL; } BarUiActDefaultEventcmd ("stationdelete"); @@ -468,14 +472,12 @@ BarUiActCallback(BarUiActSelectStation) { PianoStation_t *newStation = BarUiSelectStation (app, app->ph.stations, "Select station: ", NULL, app->settings.autoselect); if (newStation != NULL) { - app->curStation = newStation; - BarUiPrintStation (&app->settings, app->curStation); + app->nextStation = newStation; BarUiDoSkipSong (&app->player); if (app->playlist != NULL) { + /* drain playlist */ PianoDestroyPlaylist (PianoListNextP (app->playlist)); app->playlist->head.next = NULL; - BarUiHistoryPrepend (app, app->playlist); - app->playlist = NULL; } } } |