From a684fce570073cef569b13dfbfde5c75a5cabce5 Mon Sep 17 00:00:00 2001 From: Oleksiy Yakovenko Date: Fri, 2 Feb 2024 11:49:11 +0100 Subject: [PATCH] undo: fix plt_clear undo handling --- src/playlist.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/playlist.c b/src/playlist.c index ffd418eec3..9f3b8968dd 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -903,20 +903,29 @@ plt_clear (playlist_t *plt) { pl_unlock (); ddb_undobuffer_t *undobuffer = ddb_undomanager_get_buffer (ddb_undomanager_shared ()); + ddb_undobuffer_group_begin (undobuffer); while (it != NULL) { playItem_t *next = it->next[PL_MAIN]; + playItem_t *next_search = it->next[PL_SEARCH]; undo_remove_items(undobuffer, plt, &it, 1); + if (next != NULL) { + next->prev[PL_MAIN] = NULL; + } + if (next_search != NULL) { + next_search->prev[PL_SEARCH] = NULL; + } + it->next[PL_MAIN] = NULL; - it->prev[PL_MAIN] = NULL; it->next[PL_SEARCH] = NULL; - it->prev[PL_SEARCH] = NULL; + streamer_song_removed_notify (it); playqueue_remove (it); pl_item_unref (it); it = next; } + ddb_undobuffer_group_end (undobuffer); } void