From 5b9231d49d6ec90f0b82fa6a329b0826829ffcd1 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 27 Nov 2013 14:00:16 +0000 Subject: [PATCH] Tear down the save dialog and remove it from memory on surface teardown Otherwise the old save dialog will still be around if the user sets up another surface (e.g. a second edit), but won't be attached to the DOM. Bug: 57654 Change-Id: I23c10849a212534bdd0600637d8ad4fa3ebc4fb7 --- .../ve-mw/init/targets/ve.init.mw.ViewPageTarget.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index 499715782d..c8c7cb1479 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -195,11 +195,6 @@ ve.init.mw.ViewPageTarget.prototype.deactivate = function ( override ) { this.detachToolbarButtons(); } - if ( this.saveDialog ) { - // If we got as far as setting up the save dialog, tear it down - this.saveDialog.reset(); - this.saveDialog.close(); - } // Check we got as far as setting up the surface if ( this.active ) { // If we got as far as setting up the surface, tear that down @@ -1062,6 +1057,12 @@ ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () { } this.tearDownToolbar(); this.restoreDocumentTitle(); + if ( this.saveDialog ) { + // If we got as far as setting up the save dialog, tear it down + this.saveDialog.close(); + this.saveDialog.teardown(); + this.saveDialog = null; + } // Destroy surface if ( this.surface ) { this.surface.destroy();