提交 1eb0b5bc 编写于 作者: A Andre Weinand

dispose of RunOnceScheduler properly

上级 e06e6262
......@@ -28,7 +28,6 @@ import { isWindows } from 'vs/base/common/platform';
import URI from 'vs/base/common/uri';
import { ltrim } from 'vs/base/common/strings';
import { RunOnceScheduler } from 'vs/base/common/async';
import { memoize } from 'vs/base/common/decorators';
const SMART = true;
......@@ -308,7 +307,6 @@ export class LoadedScriptsView extends TreeViewsViewletPanel {
private treeContainer: HTMLElement;
private loadedScriptsItemType: IContextKey<string>;
private settings: any;
private shouldRefreshRecursive;
constructor(
options: IViewletViewOptions,
......@@ -327,16 +325,6 @@ export class LoadedScriptsView extends TreeViewsViewletPanel {
this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService);
}
@memoize
private get treeRefreshScheduler(): RunOnceScheduler {
return new RunOnceScheduler(() => {
if (this.tree) {
this.tree.refresh(undefined, this.shouldRefreshRecursive);
this.shouldRefreshRecursive = false;
}
}, 300);
}
protected renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-loaded-scripts');
......@@ -378,6 +366,15 @@ export class LoadedScriptsView extends TreeViewsViewletPanel {
}
}));
let nextRefreshIsRecursive = false;
const refreshScheduler = new RunOnceScheduler(() => {
if (this.tree) {
this.tree.refresh(undefined, nextRefreshIsRecursive);
nextRefreshIsRecursive = false;
}
}, 300);
this.disposables.push(refreshScheduler);
const root = new RootTreeItem(this.debugService.getModel(), this.environmentService, this.contextService);
this.tree.setInput(root);
......@@ -385,8 +382,8 @@ export class LoadedScriptsView extends TreeViewsViewletPanel {
this.disposables.push(session.onDidLoadedSource(event => {
const sessionRoot = root.add(session);
sessionRoot.addPath(event.source);
this.shouldRefreshRecursive = true;
this.treeRefreshScheduler.schedule();
nextRefreshIsRecursive = true;
refreshScheduler.schedule();
}));
};
......@@ -395,7 +392,7 @@ export class LoadedScriptsView extends TreeViewsViewletPanel {
this.disposables.push(this.debugService.onDidEndSession(session => {
root.remove(session.getId());
this.treeRefreshScheduler.schedule();
refreshScheduler.schedule();
}));
}
......@@ -412,8 +409,8 @@ export class LoadedScriptsView extends TreeViewsViewletPanel {
}
dispose(): void {
super.dispose();
this.tree = undefined;
super.dispose();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册