From 8fc68f79748e2c29fb64557549f65908bdf004d0 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 3 Jun 2020 14:51:56 -0700 Subject: [PATCH] Fix #99316. Clear context when notebook is being removed from DOM. --- src/vs/workbench/contrib/notebook/browser/notebookEditor.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts index 060e809f098..d53d358d119 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts @@ -141,6 +141,9 @@ export class NotebookEditor extends BaseEditor { // make sure the editor widget is removed from the view const existingEditorWidgetForInput = NotebookRegistry.getNotebookEditorWidget(this.input as NotebookEditorInput); if (existingEditorWidgetForInput) { + // the editor widget is only referenced by the editor input + // clear its state + existingEditorWidgetForInput?.onWillHide(); existingEditorWidgetForInput?.getDomNode().remove(); existingEditorWidgetForInput?.dispose(); NotebookRegistry.releaseNotebookEditorWidget(this.input as NotebookEditorInput);