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.
This commit is contained in:
Dan Winship 2011-01-06 13:38:41 -05:00
parent cff503922c
commit a46baeed0b

View File

@ -34,7 +34,8 @@ function AltTabPopup() {
AltTabPopup.prototype = { AltTabPopup.prototype = {
_init : function() { _init : function() {
this.actor = new Shell.GenericContainer({ name: 'altTabPopup', 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-width', Lang.bind(this, this._getPreferredWidth));
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
@ -365,6 +366,7 @@ AltTabPopup.prototype = {
}, },
destroy : function() { destroy : function() {
if (this.actor.visible) {
Tweener.addTween(this.actor, Tweener.addTween(this.actor,
{ opacity: 0, { opacity: 0,
time: POPUP_FADE_TIME, time: POPUP_FADE_TIME,
@ -374,6 +376,8 @@ AltTabPopup.prototype = {
this.actor.destroy(); this.actor.destroy();
}) })
}); });
} else
this.actor.destroy();
}, },
_onDestroy : function() { _onDestroy : function() {