dispose 3 leaked disposables (#242519)

* dispose 3 leaked disposables

* better name

---------

Co-authored-by: amunger <>
This commit is contained in:
Aaron Munger
2025-03-03 15:14:37 -08:00
committed by GitHub
parent 6204af729e
commit e03dd9ad93
3 changed files with 11 additions and 6 deletions
@@ -2375,6 +2375,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
return;
}
const pendingLayout = this._pendingLayouts?.get(cell);
this._pendingLayouts?.delete(cell);
if (!this.hasEditorFocus()) {
@@ -2393,6 +2394,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
this._list.updateElementHeight2(cell, height);
deferred.complete(undefined);
pendingLayout?.dispose();
};
if (this._list.inRenderingTransaction) {
@@ -84,7 +84,7 @@ export class NotebookCellListDelegate extends Disposable implements IListVirtual
}
}
abstract class AbstractCellRenderer {
abstract class AbstractCellRenderer extends Disposable {
protected readonly editorOptions: CellEditorOptions;
constructor(
@@ -99,11 +99,12 @@ abstract class AbstractCellRenderer {
language: string,
protected dndController: CellDragAndDropController | undefined
) {
this.editorOptions = new CellEditorOptions(this.notebookEditor.getBaseCellEditorOptions(language), this.notebookEditor.notebookOptions, configurationService);
super();
this.editorOptions = this._register(new CellEditorOptions(this.notebookEditor.getBaseCellEditorOptions(language), this.notebookEditor.notebookOptions, configurationService));
}
dispose() {
this.editorOptions.dispose();
override dispose() {
super.dispose();
this.dndController = undefined;
}
}
@@ -366,7 +367,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
outputShowMoreContainer,
editor,
templateDisposables,
elementDisposables: new DisposableStore(),
elementDisposables: this._register(new DisposableStore()),
cellParts,
toJSON: () => { return {}; }
};
@@ -140,11 +140,13 @@ export class NotebooKernelActionViewItem extends ActionViewItem {
@INotebookKernelService private readonly _notebookKernelService: INotebookKernelService,
@INotebookKernelHistoryService private readonly _notebookKernelHistoryService: INotebookKernelHistoryService,
) {
const action = new Action('fakeAction', undefined, ThemeIcon.asClassName(selectKernelIcon), true, (event) => actualAction.run(event));
super(
undefined,
new Action('fakeAction', undefined, ThemeIcon.asClassName(selectKernelIcon), true, (event) => actualAction.run(event)),
action,
{ ...options, label: false, icon: true }
);
this._register(action);
this._register(_editor.onDidChangeModel(this._update, this));
this._register(_notebookKernelService.onDidAddKernel(this._update, this));
this._register(_notebookKernelService.onDidRemoveKernel(this._update, this));