[gnome-shell] status/keyboard: Reset menuItems and Label objects on change
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] status/keyboard: Reset menuItems and Label objects on change
- Date: Tue, 21 Nov 2017 16:04:08 +0000 (UTC)
commit a46af9edf0b99b64501617a1159bc1beb9af218f
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Sat Oct 28 02:23:02 2017 -0500
status/keyboard: Reset menuItems and Label objects on change
In the current code it could happen that we've menuItems and indicatorLabels
for sources that aren't anymore around, because in case a source is removed
we don't cleanup the their container objects.
Also, we should nullify InputManager's _currentSource when sources change
or it might point to some invalid data again.
So it could happen that we try to access an invalid menuitem or label
if a source change happens mentioning a source that has been deleted.
https://bugzilla.gnome.org/show_bug.cgi?id=788931
js/ui/status/keyboard.js | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 70e6abf..b2f1032 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -529,6 +529,7 @@ var InputSourceManager = new Lang.Class({
let sources = this._settings.inputSources;
let nSources = sources.length;
+ this._currentSource = null;
this._inputSources = {};
this._ibusSources = {};
@@ -827,6 +828,9 @@ var InputSourceIndicator = new Lang.Class({
for (let i in this._indicatorLabels)
this._indicatorLabels[i].destroy();
+ this._menuItems = {};
+ this._indicatorLabels = {};
+
let menuIndex = 0;
for (let i in this._inputSourceManager.inputSources) {
let is = this._inputSourceManager.inputSources[i];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]