jenkins-bot has submitted this change and it was merged.

Change subject: ve.init.Target: Unset this.surface when destroying it
......................................................................


ve.init.Target: Unset this.surface when destroying it

So that getSurface() won't return a destroyed surface.

Bug: T139972
Change-Id: I5510bbe3883e84069ff08c789e378428d0b94572
(cherry picked from commit 9337fc85c0f26cfe884fde39b0b2461905b18020)
---
M src/init/ve.init.Target.js
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Divec: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/init/ve.init.Target.js b/src/init/ve.init.Target.js
index 41904fc..3aa6416 100644
--- a/src/init/ve.init.Target.js
+++ b/src/init/ve.init.Target.js
@@ -354,6 +354,11 @@
  * Destroy and remove all surfaces from the target
  */
 ve.init.Target.prototype.clearSurfaces = function () {
+       if ( this.surfaces.indexOf( this.surface ) !== -1 ) {
+               // We're about to destroy this.surface, so unset it for sanity
+               // Otherwise, getSurface() could return a destroyed surface
+               this.surface = null;
+       }
        while ( this.surfaces.length ) {
                this.surfaces.pop().destroy();
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/307710
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5510bbe3883e84069ff08c789e378428d0b94572
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: wmf/1.28.0-wmf.17
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: Divec <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to