提交 e50e16c9 编写于 作者: M Matt Bierner

Make sure we dispose of marker decorations properly

上级 674bb670
......@@ -63,10 +63,10 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor
_serviceBrand: any;
private readonly _onDidChangeMarker = new Emitter<ITextModel>();
private readonly _onDidChangeMarker = this._register(new Emitter<ITextModel>());
readonly onDidChangeMarker: Event<ITextModel> = this._onDidChangeMarker.event;
private readonly _markerDecorations: Map<string, MarkerDecorations> = new Map<string, MarkerDecorations>();
private readonly _markerDecorations = new Map<string, MarkerDecorations>();
constructor(
@IModelService modelService: IModelService,
......@@ -79,6 +79,14 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor
this._register(this._markerService.onMarkerChanged(this._handleMarkerChange, this));
}
dispose() {
super.dispose();
for (const [, decorations] of this._markerDecorations) {
decorations.dispose();
}
this._markerDecorations.clear();
}
getMarker(model: ITextModel, decoration: IModelDecoration): IMarker | null {
const markerDecorations = this._markerDecorations.get(MODEL_ID(model.uri));
return markerDecorations ? withUndefinedAsNull(markerDecorations.getMarker(decoration)) : null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册