Skip to content

Commit

Permalink
undo: fix plt_clear undo handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Feb 2, 2024
1 parent 4e37844 commit a684fce
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a684fce

Please sign in to comment.