summaryrefslogtreecommitdiff
blob: 02f830cbf531646736502e124e9ca02f60c70dc5 (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
From e6a3603b1f07cd85dbd84377afeda0777d6535e8 Mon Sep 17 00:00:00 2001
From: Zhang Dingyuan <justforlxz@gmail.com>
Date: Tue, 14 Jun 2022 11:37:40 +0800
Subject: [PATCH] fix: memory leak

agent listener does not reclaim private memory after destructing.
Use `QScopedPointer` to protect private pointers from being copied and to
reclaim memory properly.
---
 agent/polkitqt1-agent-listener.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/agent/polkitqt1-agent-listener.h b/agent/polkitqt1-agent-listener.h
index 07fe03a..a40ff41 100644
--- a/agent/polkitqt1-agent-listener.h
+++ b/agent/polkitqt1-agent-listener.h
@@ -9,6 +9,7 @@
 #define POLKITQT1_AGENT_LISTENER_H
 
 #include <QObject>
+#include <QScopedPointer>
 
 #include "polkitqt1-agent-session.h"
 
@@ -137,7 +138,7 @@ public Q_SLOTS:
     virtual void cancelAuthentication() = 0;
 
 private:
-    ListenerPrivate * const d;
+    QScopedPointer<ListenerPrivate> d;
 };
 }
 
-- 
GitLab