[gnome-shell/wip/rstrode/rhel-8.0.0: 39/50] osdWindow: Disconnect signals on destroy
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/rhel-8.0.0: 39/50] osdWindow: Disconnect signals on destroy
- Date: Sun, 17 Feb 2019 17:32:07 +0000 (UTC)
commit 15aaf1a4554f12a929a1671c98f0257a8a980191
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Sep 23 03:06:21 2018 +0200
osdWindow: Disconnect signals on destroy
Since we started to show OSD windows on all monitors, OSD windows are
destroyed when the corresponding monitor is disconnected. We shouldn't
leave any signal handlers around in that case - they prevent the object
from being garbage collected, and trigger warnings for accessing proper-
ties of invalidated GObjects.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/602
js/ui/osdWindow.js | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
index a73912413..97e0498a7 100644
--- a/js/ui/osdWindow.js
+++ b/js/ui/osdWindow.js
@@ -108,15 +108,30 @@ var OsdWindow = new Lang.Class({
this._hideTimeoutId = 0;
this._reset();
- Main.layoutManager.connect('monitors-changed',
- this._relayout.bind(this));
+ this.actor.connect('destroy', this._onDestroy.bind(this));
+
+ this._monitorsChangedId =
+ Main.layoutManager.connect('monitors-changed',
+ this._relayout.bind(this));
let themeContext = St.ThemeContext.get_for_stage(global.stage);
- themeContext.connect('notify::scale-factor',
- this._relayout.bind(this));
+ this._scaleChangedId =
+ themeContext.connect('notify::scale-factor',
+ this._relayout.bind(this));
this._relayout();
Main.uiGroup.add_child(this.actor);
},
+ _onDestroy() {
+ if (this._monitorsChangedId)
+ Main.layoutManager.disconnect(this._monitorsChangedId);
+ this._monitorsChangedId = 0;
+
+ let themeContext = St.ThemeContext.get_for_stage(global.stage);
+ if (this._scaleChangedId)
+ themeContext.disconnect(this._scaleChangedId);
+ this._scaleChangedId = 0;
+ },
+
setIcon(icon) {
this._icon.gicon = icon;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]