Code

screen_lyrics, screen_song: duplicate "next_song"
[ncmpc.git] / src / screen_song.c
index 8328415bf413a48bd63ba06c977e7733e91db68d..a7d6f8ee4c087c4dbdae4b189c4c528465bd7985 100644 (file)
@@ -28,7 +28,7 @@
 
 static list_window_t *lw;
 
-static const struct mpd_song *next_song;
+static struct mpd_song *next_song;
 
 static struct {
        struct mpd_song *selected_song;
@@ -315,7 +315,7 @@ screen_song_update(mpdclient_t *c)
        /* If a song was selected before the song screen was opened */
        if (next_song != NULL) {
                assert(current.selected_song == NULL);
-               current.selected_song = mpd_songDup(next_song);
+               current.selected_song = next_song;
                next_song = NULL;
        }
 
@@ -373,11 +373,11 @@ screen_song_cmd(mpdclient_t *c, command_t cmd)
 #ifdef ENABLE_LYRICS_SCREEN
        case CMD_SCREEN_LYRICS:
                if (current.selected_song != NULL) {
-                       screen_lyrics_switch(c, current.selected_song);
+                       screen_lyrics_switch(c, current.selected_song, false);
                        return true;
                }
                if (current.played_song != NULL) {
-                       screen_lyrics_switch(c, current.played_song);
+                       screen_lyrics_switch(c, current.played_song, true);
                        return true;
                }
                return false;
@@ -426,6 +426,6 @@ screen_song_switch(mpdclient_t *c, const struct mpd_song *song)
        assert(current.selected_song == NULL);
        assert(current.played_song == NULL);
 
-       next_song = song;
+       next_song = mpd_songDup(song);
        screen_switch(&screen_song, c);
 }