[gnome-shell/wip/rstrode/rhel-7.9: 78/86] userWidget: Disconnect signal connections on destroy
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/rhel-7.9: 78/86] userWidget: Disconnect signal connections on destroy
- Date: Fri, 12 Feb 2021 19:04:08 +0000 (UTC)
commit 413966b3d456bba221cefd47f135620662532bde
Author: Ray Strode <rstrode redhat com>
Date: Mon Sep 28 22:28:08 2020 -0400
userWidget: Disconnect signal connections on destroy
At the moment an Avatar (and StIcon) are getting leaked
every time the screen is locked.
This is because the Avatar class sets up a global signal
connection that prevents the object from getting garbage
collected when its actor is destroyed.
This commit adds a destroy handler to disconnect the
signal connection.
js/ui/userWidget.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js
index 4e1ce25e92..0a80fa6720 100644
--- a/js/ui/userWidget.js
+++ b/js/ui/userWidget.js
@@ -36,9 +36,19 @@ var Avatar = new Lang.Class({
width: this._iconSize * scaleFactor,
height: this._iconSize * scaleFactor });
+ this.actor.connect('destroy', this._onDestroy.bind(this));
+
// Monitor the scaling factor to make sure we recreate the avatar when needed.
let themeContext = St.ThemeContext.get_for_stage(global.stage);
- themeContext.connect('notify::scale-factor', this.update.bind(this));
+ this._scaleFactorChangedId = themeContext.connect('notify::scale-factor', this.update.bind(this));
+ },
+
+ _onDestroy() {
+ if (this._scaleFactorChangedId != 0) {
+ let themeContext = St.ThemeContext.get_for_stage(global.stage);
+ themeContext.disconnect(this._scaleFactorChangedId);
+ this._scaleFactorChangedId = 0;
+ }
},
setSensitive(sensitive) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]