Fix broken playlist undostack when i.e. removing duplicates and unavailable songs
This commit is contained in:
@@ -930,7 +930,8 @@ void Playlist::InsertItems(const PlaylistItemList &itemsIn, int pos, bool play_n
|
||||
// Too big to keep in the undo stack. Also clear the stack because it might have been invalidated.
|
||||
InsertItemsWithoutUndo(items, pos, enqueue, enqueue_next);
|
||||
undo_stack_->clear();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
undo_stack_->push(new PlaylistUndoCommands::InsertItems(this, items, pos, enqueue, enqueue_next));
|
||||
}
|
||||
|
||||
@@ -1384,6 +1385,8 @@ void Playlist::RemoveItemsWithoutUndo(const QList<int> &indicesIn) {
|
||||
|
||||
bool Playlist::removeRows(int row, int count, const QModelIndex &parent) {
|
||||
|
||||
Q_UNUSED(parent);
|
||||
|
||||
if (row < 0 || row >= items_.size() || row + count > items_.size()) {
|
||||
return false;
|
||||
}
|
||||
@@ -1393,9 +1396,6 @@ bool Playlist::removeRows(int row, int count, const QModelIndex &parent) {
|
||||
RemoveItemsWithoutUndo(row, count);
|
||||
undo_stack_->clear();
|
||||
}
|
||||
else if (parent == QModelIndex()) {
|
||||
RemoveItemsWithoutUndo(row, count);
|
||||
}
|
||||
else {
|
||||
undo_stack_->push(new PlaylistUndoCommands::RemoveItems(this, row, count));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user