summaryrefslogtreecommitdiff
blob: b112edced777b1b1d4174824bcd6b000444fe73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
commit 58e932c607db27bea2872625661991fb16c79d13
Author: Kai Uwe Broulik <kde@privat.broulik.de>
Date:   Tue Jan 3 09:37:38 2017 +0100

    [Task Manager] Parent QAction to "parent" instead of this
    
    This ensures the QAction is disposed of once the menu gets destroyed rather than
    accumulating forever - the methods already took a "parent" argument,
    which is passed the menu from QML side, for exactly that purpose.
    
    Differential Revision: https://phabricator.kde.org/D3816

diff --git a/applets/taskmanager/plugin/backend.cpp b/applets/taskmanager/plugin/backend.cpp
index 16f1f57..efbd095 100644
--- a/applets/taskmanager/plugin/backend.cpp
+++ b/applets/taskmanager/plugin/backend.cpp
@@ -142,7 +142,7 @@ QVariantList Backend::jumpListActions(const QUrl &launcherUrl, QObject *parent)
             continue;
         }
 
-        QAction *action = new QAction(this);
+        QAction *action = new QAction(parent);
         action->setText(name);
         action->setIcon(QIcon::fromTheme(actionGroup.readEntry("Icon")));
         action->setProperty("exec", exec);
@@ -204,7 +204,7 @@ QVariantList Backend::recentDocumentActions(const QUrl &launcherUrl, QObject *pa
             continue;
         }
 
-        QAction *action = new QAction(this);
+        QAction *action = new QAction(parent);
         action->setText(url.fileName());
         action->setIcon(QIcon::fromTheme(fileItem.iconName(), QIcon::fromTheme("unknown")));
         action->setProperty("agent", storageId);
@@ -219,7 +219,7 @@ QVariantList Backend::recentDocumentActions(const QUrl &launcherUrl, QObject *pa
     }
 
     if (actionCount > 0) {
-        QAction *action = new QAction(this);
+        QAction *action = new QAction(parent);
         action->setText(i18n("Forget Recent Documents"));
         action->setProperty("agent", storageId);
         connect(action, &QAction::triggered, this, &Backend::handleRecentDocumentAction);