summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Keller <skeller@gnome.org>2022-08-29 00:03:50 +0200
committerMarge Bot <marge-bot@gnome.org>2022-08-29 21:53:58 +0000
commit085102be74f4c98094712a165e5128feaca50438 (patch)
tree20831bf0a22023778d12f07d2ef9764516c112eb
parent2d589ec36502914fd1791046b1235e6bff91d7e6 (diff)
downloadgnome-shell-085102be74f4c98094712a165e5128feaca50438.tar.gz
signalTracker: Use WeakMap in SignalManager to avoid leaking objects
The object the SignalTracker belongs to is stored in a map managed by the SignalManager which keeps a reference to that object. This map is never destroyed nor is any entry ever removed. This leads to all objects that ever had SignalTrackers used on them being kept alive even after all references outside of the SignalTracker are long gone. This then also extends to other objects which are leaked indirectly through reference chains from these objects. And if some of those objects are GObjects, this will prevent them from being finalized, leaking further resources. A StWidget for example will not release its shadow textures. Fix this by using a WeakMap in SignalManager. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5807 Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5796 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2450>
-rw-r--r--js/misc/signalTracker.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/misc/signalTracker.js b/js/misc/signalTracker.js
index 1c3f4f9df..8444564df 100644
--- a/js/misc/signalTracker.js
+++ b/js/misc/signalTracker.js
@@ -42,7 +42,7 @@ class SignalManager {
}
constructor() {
- this._signalTrackers = new Map();
+ this._signalTrackers = new WeakMap();
}
/**