From a8074f7e9a66b630eb968686f571dd6a36893dc0 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 18 Jul 2016 11:02:29 +0200 Subject: [PATCH] dispose replace preview diff editor --- .../workbench/parts/search/browser/replaceService.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/parts/search/browser/replaceService.ts b/src/vs/workbench/parts/search/browser/replaceService.ts index f099fb6a2c7..91b52f24588 100644 --- a/src/vs/workbench/parts/search/browser/replaceService.ts +++ b/src/vs/workbench/parts/search/browser/replaceService.ts @@ -68,8 +68,8 @@ class EditorInputCache { let editorInputPromise= this.cache.get(resourceUri); if (editorInputPromise) { editorInputPromise.done((diffInput) => { - this.disposeReplaceInput(this.getReplaceResource(resourceUri), diffInput); - this.cache.delete(resourceUri); + this.cleanInput(resourceUri); + diffInput.dispose(); }); } } @@ -84,6 +84,7 @@ class EditorInputCache { this.createRightInput(fileMatch)]).then(inputs => { const [left, right] = inputs; let editorInput= new DiffEditorInput(nls.localize('fileReplaceChanges', "{0} ↔ {1} (Replace Preview)", fileMatch.name(), fileMatch.name()), undefined, left, right); + editorInput.addListener2('dispose', () => this.cleanInput(fileMatch.resource())); return editorInput; }); } @@ -103,9 +104,9 @@ class EditorInputCache { }); } - private disposeReplaceInput(replaceUri: URI, diffInput: EditorInput):void { - diffInput.dispose(); - this.modelService.destroyModel(replaceUri); + private cleanInput(resourceUri: URI):void { + this.modelService.destroyModel(this.getReplaceResource(resourceUri)); + this.cache.delete(resourceUri); } private getReplaceResource(resource: URI): URI { -- GitLab