Make sure we dispose of CellOutputViewModel (#131146)

`CellOutputViewModel` is disposable but doesn't seem to get cleaned up currently
This commit is contained in:
Matt Bierner 2021-08-19 13:58:01 -07:00 committed by GitHub
parent d374ee1910
commit 8361b4d101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -129,7 +129,7 @@ export interface IRenderOutputViaExtension {
export type IInsetRenderOutput = IRenderPlainHtmlOutput | IRenderOutputViaExtension;
export type IRenderOutput = IRenderMainframeOutput | IInsetRenderOutput;
export interface ICellOutputViewModel {
export interface ICellOutputViewModel extends IDisposable {
cellViewModel: IGenericCellViewModel;
/**
* When rendering an output, `model` should always be used as we convert legacy `text/error` output to `display_data` output under the hood.

View file

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Emitter, Event } from 'vs/base/common/event';
import { dispose } from 'vs/base/common/lifecycle';
import * as UUID from 'vs/base/common/uuid';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
@ -118,6 +119,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
this._onDidChangeOutputs.fire(splice);
this._onDidRemoveOutputs.fire(removedOutputs);
this.layoutChange({ outputHeight: true }, 'CodeCellViewModel#model.onDidChangeOutputs');
dispose(removedOutputs);
}));
this._register(this.model.onDidChangeMetadata(e => {
@ -424,5 +426,6 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
this._outputCollection = [];
this._outputsTop = null;
dispose(this._outputViewModels);
}
}