Skip to content

Commit f8cb1c1

Browse files
hsitterluisbocanegra
authored andcommitted
don't leak dbus replies
1 parent ace313c commit f8cb1c1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

package/contents/ui/DBusPrimary.qml

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ QtObject {
2828
function call(callback) {
2929
const reply = DBus.SessionBus.asyncCall(root.msg) as DBus.DBusPendingReply
3030
if (callback) {
31-
reply.finished.connect(() => callback(reply))
31+
reply.finished.connect(() => {
32+
callback(reply)
33+
// Make sure to destroy after the reply is finished otherwise it may get leaked because the connected signal
34+
// holds a reference and prevents garbage collection.
35+
// https://discuss.kde.org/t/high-memory-usage-from-plasmashell-is-it-a-memory-leak/29105
36+
reply.destroy()
37+
})
3238
}
3339
}
3440
}

0 commit comments

Comments
 (0)