Delete some items that were intended to be deleted. Avoid trying to delete items that don't exist

When deleting items of a list, follow a sequence that ensures that the item
that is going to be deleted exists.

Revision: https://invent.kde.org/system/dolphin/-/merge_requests/240
This commit is contained in:
Toni Asensi Esteve 2021-07-17 19:47:57 +02:00
parent 2c7a1f4b4c
commit 3bde6ba13c

View file

@ -66,7 +66,7 @@ void DolphinRecentTabsMenu::handleAction(QAction* action)
// action and the separator
QList<QAction*> actions = menu()->actions();
const int count = actions.size();
for (int i = 2; i < count; ++i) {
for (int i = count - 1; i >= 2; i--) {
removeAction(actions.at(i));
}
Q_EMIT closedTabsCountChanged(0);