From d517e3e3dec944d522d6b927d66d62197aeb3e57 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 13 Oct 2016 15:43:27 +0200 Subject: [PATCH] fix #13363 --- .../services/textfile/common/textFileEditorModelManager.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts index a1d2ed6fc60..605772ca838 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts @@ -65,8 +65,9 @@ export class TextFileEditorModelManager implements ITextFileEditorModelManager { private registerListeners(): void { - // Editors changing + // Editors changing/closing this.toUnbind.push(this.editorGroupService.onEditorsChanged(() => this.onEditorsChanged())); + this.toUnbind.push(this.editorGroupService.getStacksModel().onEditorClosed(() => this.onEditorClosed())); // File changes this.toUnbind.push(this.eventService.addListener2('files.internal:fileChanged', (e: LocalFileChangeEvent) => this.onLocalFileChange(e))); @@ -80,6 +81,10 @@ export class TextFileEditorModelManager implements ITextFileEditorModelManager { this.disposeUnusedModels(); } + private onEditorClosed(): void { + this.disposeUnusedModels(); + } + private disposeModelIfPossible(resource: URI): void { const model = this.get(resource); if (this.canDispose(model)) { -- GitLab