Commit 80539089 authored by Jonathan Marten's avatar Jonathan Marten
Browse files

Klipper (classic widget): Fix a system tray menu memory leak

Clipboard history item actions are added to the menu by
KlipperPopup::rebuild() or PopupProxy::tryInsertItem().
The actions are removed from the menu again at the start
of KlipperPopup::rebuild(), but were never deleted.
parent 560b4ca5
Pipeline #190277 passed with stage
in 8 minutes and 2 seconds
......@@ -138,7 +138,13 @@ void KlipperPopup::rebuild(const QString &filter)
} else {
for (int i = 0; i < m_nHistoryItems; i++) {
Q_ASSERT(TOP_HISTORY_ITEM_INDEX < actions().count());
removeAction(actions().at(TOP_HISTORY_ITEM_INDEX));
// The old actions allocated by KlipperPopup::rebuild()
// and PopupProxy::tryInsertItem() are deleted here when
// the menu is rebuilt.
QAction *action = actions().at(TOP_HISTORY_ITEM_INDEX);
removeAction(action);
action->deleteLater();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment