]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Delete some items that were intended to be deleted. Avoid trying to delete items...
authorToni Asensi Esteve <toni.asensi@kdemail.net>
Sat, 17 Jul 2021 17:47:57 +0000 (19:47 +0200)
committerToni Asensi Esteve <toni.asensi@kdemail.net>
Sat, 17 Jul 2021 17:50:52 +0000 (19:50 +0200)
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

index 38eb4f65717b89d7161a6f17237817c10bc9cf75..d8bd06b5c82a529ba5da17f8edbdb1a03f49e083 100644 (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);