while resolving an editor input it might get disposed

This commit is contained in:
Johannes Rieken 2021-02-12 18:29:49 +01:00
parent 52f633d19c
commit 1f1db8515e

View file

@ -160,11 +160,12 @@ ${patterns}
if (!this._textModel) {
this._textModel = await this._notebookModelResolverService.resolve(this.resource, this.viewType!);
this._register(this._textModel.object.onDidChangeDirty(() => {
this._onDidChangeDirty.fire();
}));
if (this.isDisposed()) {
this._textModel.dispose();
this._textModel = null;
return null;
}
this._register(this._textModel.object.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
if (this._textModel.object.isDirty()) {
this._onDidChangeDirty.fire();
}
@ -185,10 +186,8 @@ ${patterns}
}
dispose() {
if (this._textModel) {
this._textModel.dispose();
this._textModel = null;
}
this._textModel?.dispose();
this._textModel = null;
super.dispose();
}
}