From 3bde6ba13c3ba46369aa2c2e439fbf635c6aedea Mon Sep 17 00:00:00 2001 From: Toni Asensi Esteve Date: Sat, 17 Jul 2021 19:47:57 +0200 Subject: [PATCH] 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 --- src/dolphinrecenttabsmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dolphinrecenttabsmenu.cpp b/src/dolphinrecenttabsmenu.cpp index 38eb4f6571..d8bd06b5c8 100644 --- a/src/dolphinrecenttabsmenu.cpp +++ b/src/dolphinrecenttabsmenu.cpp @@ -66,7 +66,7 @@ void DolphinRecentTabsMenu::handleAction(QAction* action) // action and the separator QList 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);