From a46baeed0b51991d3bcaf0924c80dd6dfe5756ab Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 6 Jan 2011 13:38:41 -0500 Subject: [PATCH] altTab: fix destroy-without-showing case If the switcher is destroyed without ever being fully shown (either because it couldn't get a keyboard grab, or just because there are no apps to display), destroy it immediately rather than tweening it towards destruction, since its contents haven't been built yet and _allocate() will throw errors if it runs. --- js/ui/altTab.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/js/ui/altTab.js b/js/ui/altTab.js index ca2b902be..b117fc840 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -34,7 +34,8 @@ function AltTabPopup() { AltTabPopup.prototype = { _init : function() { this.actor = new Shell.GenericContainer({ name: 'altTabPopup', - reactive: true }); + reactive: true, + visible: false }); this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); @@ -365,15 +366,18 @@ AltTabPopup.prototype = { }, destroy : function() { - Tweener.addTween(this.actor, - { opacity: 0, - time: POPUP_FADE_TIME, - transition: 'easeOutQuad', - onComplete: Lang.bind(this, - function() { - this.actor.destroy(); - }) - }); + if (this.actor.visible) { + Tweener.addTween(this.actor, + { opacity: 0, + time: POPUP_FADE_TIME, + transition: 'easeOutQuad', + onComplete: Lang.bind(this, + function() { + this.actor.destroy(); + }) + }); + } else + this.actor.destroy(); }, _onDestroy : function() {