[gnome-shell/issue-23: 4/5] altTab: Ensure no undefined objects are referenced after quitting an app
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/issue-23: 4/5] altTab: Ensure no undefined objects are referenced after quitting an app
- Date: Mon, 5 Feb 2018 12:00:05 +0000 (UTC)
commit 0754eccbda87e423317beec999e6fbc846a546f9
Author: Mario Sanchez Prada <mario endlessm com>
Date: Mon Dec 4 22:54:08 2017 +0000
altTab: Ensure no undefined objects are referenced after quitting an app
Add a few extra checks to prevent hitting undefined items when destroying
the list of thumbnails (if any) and selecting a new application after
quitting an application right from the switcher.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/23
Closes: #23
js/ui/altTab.js | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 1b8280cc7..702a56883 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -156,6 +156,14 @@ var AppSwitcherPopup = new Lang.Class({
this._items[this._selectedIndex].cachedWindows.length);
},
+ _quitApplication: function(appIndex) {
+ let appIcon = this._items[appIndex];
+ if (!appIcon)
+ return;
+
+ appIcon.app.request_quit();
+ },
+
_keyPressHandler: function(keysym, action) {
if (action == Meta.KeyBindingAction.SWITCH_GROUP) {
if (!this._thumbnailsFocused)
@@ -176,7 +184,7 @@ var AppSwitcherPopup = new Lang.Class({
else if (keysym == Clutter.Up)
this._select(this._selectedIndex, null, true);
else if (keysym == Clutter.q)
- this._items[this._selectedIndex].app.request_quit();
+ this._quitApplication(this._selectedIndex);
else
return Clutter.EVENT_PROPAGATE;
} else {
@@ -187,7 +195,7 @@ var AppSwitcherPopup = new Lang.Class({
else if (keysym == Clutter.Down)
this._select(this._selectedIndex, 0);
else if (keysym == Clutter.q)
- this._items[this._selectedIndex].app.request_quit();
+ this._quitApplication(this._selectedIndex);
else
return Clutter.EVENT_PROPAGATE;
}
@@ -347,7 +355,8 @@ var AppSwitcherPopup = new Lang.Class({
onCompleteScope: this
});
this._thumbnails = null;
- this._switcherList._items[this._selectedIndex].remove_accessible_state (Atk.StateType.EXPANDED);
+ if (this._switcherList._items[this._selectedIndex])
+ this._switcherList._items[this._selectedIndex].remove_accessible_state (Atk.StateType.EXPANDED);
},
_createThumbnails : function() {
@@ -755,7 +764,7 @@ var AppSwitcher = new Lang.Class({
// show a dim arrow, but show a bright arrow when they are
// highlighted.
highlight : function(n, justOutline) {
- if (this._curApp != -1) {
+ if (this.icons[this._curApp]) {
if (this.icons[this._curApp].cachedWindows.length == 1)
this._arrows[this._curApp].hide();
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]