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,15 +366,18 @@ AltTabPopup.prototype = {
}, },
destroy : function() { destroy : function() {
Tweener.addTween(this.actor, if (this.actor.visible) {
{ opacity: 0, Tweener.addTween(this.actor,
time: POPUP_FADE_TIME, { opacity: 0,
transition: 'easeOutQuad', time: POPUP_FADE_TIME,
onComplete: Lang.bind(this, transition: 'easeOutQuad',
function() { onComplete: Lang.bind(this,
this.actor.destroy(); function() {
}) this.actor.destroy();
}); })
});
} else
this.actor.destroy();
}, },
_onDestroy : function() { _onDestroy : function() {