From 0f5331e497e63f32213e4162d93041fe79aaf1ea Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 14 Jun 2016 12:15:48 +0200 Subject: [PATCH] dispose inputs in history when removing --- src/vs/workbench/services/history/browser/history.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index 531b5f8b05c..d48888aae3d 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -269,7 +269,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic // Bounding if (this.recentlyClosed.length > HistoryService.MAX_RECENTLY_CLOSED_EDITORS) { - this.recentlyClosed = this.recentlyClosed.slice(this.recentlyClosed.length - HistoryService.MAX_RECENTLY_CLOSED_EDITORS); // upper bound of recently closed + this.recentlyClosed.shift().dispose(); // remove first and dispose } // Restore on dispose @@ -363,7 +363,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic // Respect max entries setting if (this.history.length > HistoryService.MAX_HISTORY_ITEMS) { - this.history = this.history.slice(0, HistoryService.MAX_HISTORY_ITEMS); + this.history.pop().dispose(); // remove and dispose last } // Restore on dispose @@ -495,7 +495,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic // Check for limit if (this.stack.length > HistoryService.MAX_STACK_ITEMS) { - this.stack.shift(); // remove first + this.stack.shift().input.dispose(); // remove first and dispose if (this.index > 0) { this.index--; }