Skip to content

Commit d1621ba

Browse files
authored
Merge pull request microsoft#189007 from microsoft/constant-tarantula
fix memory leak
2 parents 67ce925 + 8888ed6 commit d1621ba

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ export class NotebookCellOutline implements IOutline<OutlineEntry> {
314314
this._onDidChange.dispose();
315315
this._dispoables.dispose();
316316
this._entriesDisposables.dispose();
317+
this._outlineProvider?.dispose();
317318
}
318319
}
319320

src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
325325

326326
this._register(this.instantiationService.createInstance(NotebookEditorContextKeys, this));
327327

328-
this._notebookOutline = this.instantiationService.createInstance(NotebookCellOutlineProvider, this, OutlineTarget.QuickPick);
328+
this._notebookOutline = this._register(this.instantiationService.createInstance(NotebookCellOutlineProvider, this, OutlineTarget.QuickPick));
329329

330330
this._register(notebookKernelService.onDidChangeSelectedNotebooks(e => {
331331
if (isEqual(e.notebook, this.viewModel?.uri)) {

src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export class NotebookCellOutlineProvider {
185185

186186
dispose(): void {
187187
// selectionListener.clear();
188+
this._entriesDisposables.dispose();
188189
this._dispoables.dispose();
189190
}
190191

@@ -329,6 +330,11 @@ export class NotebookCellOutlineProvider {
329330
};
330331
if (this._configurationService.getValue(OutlineConfigKeys.problemsEnabled)) {
331332
markerServiceListener.value = this._markerService.onMarkerChanged(e => {
333+
if (notebookEditorWidget.isDisposed) {
334+
console.error('notebook editor is disposed');
335+
return;
336+
}
337+
332338
if (e.some(uri => notebookEditorWidget.getCellsInRange().some(cell => isEqual(cell.uri, uri)))) {
333339
doUpdateMarker(false);
334340
this._onDidChange.fire({});

0 commit comments

Comments
 (0)