Merge "Use a sane recursion guard in ve.ui.Context.prototype.hide()"

This commit is contained in:
jenkins-bot 2013-10-23 13:49:45 +00:00 committed by Gerrit Code Review
commit fad9ae6c50

View file

@ -24,6 +24,7 @@ ve.ui.Context = function VeUiContext( surface, config ) {
this.inspectors = {};
this.visible = false;
this.showing = false;
this.hiding = false;
this.selecting = false;
this.relocating = false;
this.embedded = false;
@ -382,16 +383,17 @@ ve.ui.Context.prototype.show = function ( transition, repositionOnly ) {
ve.ui.Context.prototype.hide = function () {
var inspector = this.inspectors.getCurrent();
// Guard against recursion: closing the inspector causes onInspectorClose to call us again
if ( !this.hiding ) {
this.hiding = true;
if ( inspector ) {
// This will recurse, but inspector will be undefined next time
inspector.close( 'hide' );
return this;
}
this.popup.hide();
this.$.hide();
this.visible = false;
this.hiding = false;
}
return this;
};