|
|
c7fac9 |
From 952ad185cc54eea2e9915b8d93dded1ac0ddf8ac Mon Sep 17 00:00:00 2001
|
|
|
c7fac9 |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
c7fac9 |
Date: Sun, 23 Sep 2018 03:06:21 +0200
|
|
|
c7fac9 |
Subject: [PATCH] osdWindow: Disconnect signals on destroy
|
|
|
c7fac9 |
|
|
|
c7fac9 |
Since we started to show OSD windows on all monitors, OSD windows are
|
|
|
c7fac9 |
destroyed when the corresponding monitor is disconnected. We shouldn't
|
|
|
c7fac9 |
leave any signal handlers around in that case - they prevent the object
|
|
|
c7fac9 |
from being garbage collected, and trigger warnings for accessing proper-
|
|
|
c7fac9 |
ties of invalidated GObjects.
|
|
|
c7fac9 |
|
|
|
c7fac9 |
https://gitlab.gnome.org/GNOME/gnome-shell/issues/602
|
|
|
c7fac9 |
---
|
|
|
c7fac9 |
js/ui/osdWindow.js | 23 +++++++++++++++++++----
|
|
|
c7fac9 |
1 file changed, 19 insertions(+), 4 deletions(-)
|
|
|
c7fac9 |
|
|
|
c7fac9 |
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
|
|
|
c7fac9 |
index a73912413..97e0498a7 100644
|
|
|
c7fac9 |
--- a/js/ui/osdWindow.js
|
|
|
c7fac9 |
+++ b/js/ui/osdWindow.js
|
|
|
c7fac9 |
@@ -108,15 +108,30 @@ var OsdWindow = new Lang.Class({
|
|
|
c7fac9 |
this._hideTimeoutId = 0;
|
|
|
c7fac9 |
this._reset();
|
|
|
c7fac9 |
|
|
|
c7fac9 |
- Main.layoutManager.connect('monitors-changed',
|
|
|
c7fac9 |
- this._relayout.bind(this));
|
|
|
c7fac9 |
+ this.actor.connect('destroy', this._onDestroy.bind(this));
|
|
|
c7fac9 |
+
|
|
|
c7fac9 |
+ this._monitorsChangedId =
|
|
|
c7fac9 |
+ Main.layoutManager.connect('monitors-changed',
|
|
|
c7fac9 |
+ this._relayout.bind(this));
|
|
|
c7fac9 |
let themeContext = St.ThemeContext.get_for_stage(global.stage);
|
|
|
c7fac9 |
- themeContext.connect('notify::scale-factor',
|
|
|
c7fac9 |
- this._relayout.bind(this));
|
|
|
c7fac9 |
+ this._scaleChangedId =
|
|
|
c7fac9 |
+ themeContext.connect('notify::scale-factor',
|
|
|
c7fac9 |
+ this._relayout.bind(this));
|
|
|
c7fac9 |
this._relayout();
|
|
|
c7fac9 |
Main.uiGroup.add_child(this.actor);
|
|
|
c7fac9 |
},
|
|
|
c7fac9 |
|
|
|
c7fac9 |
+ _onDestroy() {
|
|
|
c7fac9 |
+ if (this._monitorsChangedId)
|
|
|
c7fac9 |
+ Main.layoutManager.disconnect(this._monitorsChangedId);
|
|
|
c7fac9 |
+ this._monitorsChangedId = 0;
|
|
|
c7fac9 |
+
|
|
|
c7fac9 |
+ let themeContext = St.ThemeContext.get_for_stage(global.stage);
|
|
|
c7fac9 |
+ if (this._scaleChangedId)
|
|
|
c7fac9 |
+ themeContext.disconnect(this._scaleChangedId);
|
|
|
c7fac9 |
+ this._scaleChangedId = 0;
|
|
|
c7fac9 |
+ },
|
|
|
c7fac9 |
+
|
|
|
c7fac9 |
setIcon(icon) {
|
|
|
c7fac9 |
this._icon.gicon = icon;
|
|
|
c7fac9 |
},
|
|
|
c7fac9 |
--
|
|
|
c7fac9 |
2.20.1
|
|
|
c7fac9 |
|