Dispose underlying text model when disposing notebook editor model (#19955)

This commit is contained in:
Cory Rivera
2022-07-08 11:23:50 -07:00
committed by GitHub
parent 0efa4c84da
commit 6b535b7945
2 changed files with 31 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ export class NotebookEditorModel extends EditorModel {
}, err => undefined);
}
}));
this._register(this.textEditorModel);
if (this.textEditorModel instanceof UntitledTextEditorModel) {
this._register(this.textEditorModel.onDidChangeDirty(e => {
let dirty = this.textEditorModel instanceof TextResourceEditorModel ? false : this.textEditorModel.isDirty();
@@ -420,6 +421,7 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
}
} else {
const textEditorModelReference = await this.textModelService.createModelReference(this.resource);
this._register(textEditorModelReference);
textEditorModelReference.object.textEditorModel.onBeforeAttached();
await textEditorModelReference.object.resolve();
textOrUntitledEditorModel = textEditorModelReference.object as TextFileEditorModel | TextResourceEditorModel;