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
// action and the separator
QList<QAction*> actions = menu()->actions();
const int count = actions.size();
// 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);
removeAction(actions.at(i));
}
Q_EMIT closedTabsCountChanged(0);