foldermodel: give KFileItemActions a QObject to own plugin-returned actions

There is no QWidget to use as parentWidget on this QML path, so
plugins that need an owner for the QActions they return (such as
Dolphin's folder icon action via KFileItemActionPluginV2) got nullptr
and leaked them.

Pass the popup menu through KFileItemActions::setParentObject(), added
in KIO 6.32 (https://invent.kde.org/frameworks/kio/-/merge_requests/2427).
The menu is deleted right after the popup closes, which also frees the
actions. It is not set as parentWidget, since that is also used for job
dialogs that must outlive the popup.

CCBUG: 525162
This commit is contained in:
Zühtü Eren İncekara 2026-10-30 19:03:21 +03:00 committed by Nate Graham
parent bed7916645
commit cb94120457

View file

@ -2032,6 +2032,8 @@ void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifier
if (!m_fileItemActions) {
m_fileItemActions = new KFileItemActions(this);
}
// Let `menu` own the QActions plugins return, so they go away with the popup (see aboutToHide below).
m_fileItemActions->setParentObject(menu);
if (indexes.isEmpty()) {
menu->addAction(m_actionCollection.action(QStringLiteral("newMenu")));