┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2026-02-11 11:45:20 +0100
committerMéven Car <[email protected]>2026-02-11 10:47:03 +0000
commit69999c70f14ef3fd03669ac034ef059960b008e8 (patch)
tree435164554b252fb2917e02c822c3eeb510ee08f7 /src/panels
parentac5045498cd239c396db70015968a6b62c69c8a1 (diff)
panels/panels: handle lifetime of internal actions
Preventing a mem-leak on process leave.
Diffstat (limited to 'src/panels')
-rw-r--r--src/panels/places/placespanel.cpp12
-rw-r--r--src/panels/places/placespanel.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 12d7619b8..ed2341872 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -42,18 +42,18 @@ PlacesPanel::PlacesPanel(QWidget *parent)
slotTearDownRequested(index);
});
- m_openInSplitView = new QAction(QIcon::fromTheme(QStringLiteral("view-split-left-right")), i18nc("@action:inmenu", "Open in Split View"));
+ m_openInSplitView = std::make_unique<QAction>(QIcon::fromTheme(QStringLiteral("view-split-left-right")), i18nc("@action:inmenu", "Open in Split View"));
m_openInSplitView->setPriority(QAction::HighPriority);
- connect(m_openInSplitView, &QAction::triggered, this, [this]() {
+ connect(m_openInSplitView.get(), &QAction::triggered, this, [this]() {
const QUrl url = currentIndex().data(KFilePlacesModel::UrlRole).toUrl();
Q_EMIT openInSplitViewRequested(url);
});
- addAction(m_openInSplitView);
+ addAction(m_openInSplitView.get());
- m_configureTrashAction = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18nc("@action:inmenu", "Configure Trash…"));
+ m_configureTrashAction = std::make_unique<QAction>(QIcon::fromTheme(QStringLiteral("configure")), i18nc("@action:inmenu", "Configure Trash…"));
m_configureTrashAction->setPriority(QAction::HighPriority);
- connect(m_configureTrashAction, &QAction::triggered, this, &PlacesPanel::slotConfigureTrash);
- addAction(m_configureTrashAction);
+ connect(m_configureTrashAction.get(), &QAction::triggered, this, &PlacesPanel::slotConfigureTrash);
+ addAction(m_configureTrashAction.get());
connect(this, &PlacesPanel::contextMenuAboutToShow, this, &PlacesPanel::slotContextMenuAboutToShow);
diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h
index dd5cb6d9e..3bacfcb94 100644
--- a/src/panels/places/placespanel.h
+++ b/src/panels/places/placespanel.h
@@ -73,8 +73,8 @@ private:
QPersistentModelIndex m_indexToTearDown;
- QAction *m_configureTrashAction;
- QAction *m_openInSplitView;
+ std::unique_ptr<QAction> m_configureTrashAction;
+ std::unique_ptr<QAction> m_openInSplitView;
QAction *m_lockPanelsAction;
};