mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Make sure we dispose of marker decorations properly
This commit is contained in:
parent
674bb6700b
commit
e50e16c9ec
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue