Merge pull request #189007 from microsoft/constant-tarantula

fix memory leak
This commit is contained in:
Peng Lyu 2023-07-26 18:20:48 -07:00 committed by GitHub
commit d1621baf8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -314,6 +314,7 @@ export class NotebookCellOutline implements IOutline<OutlineEntry> {
this._onDidChange.dispose();
this._dispoables.dispose();
this._entriesDisposables.dispose();
this._outlineProvider?.dispose();
}
}

View file

@ -325,7 +325,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
this._register(this.instantiationService.createInstance(NotebookEditorContextKeys, this));
this._notebookOutline = this.instantiationService.createInstance(NotebookCellOutlineProvider, this, OutlineTarget.QuickPick);
this._notebookOutline = this._register(this.instantiationService.createInstance(NotebookCellOutlineProvider, this, OutlineTarget.QuickPick));
this._register(notebookKernelService.onDidChangeSelectedNotebooks(e => {
if (isEqual(e.notebook, this.viewModel?.uri)) {

View file

@ -185,6 +185,7 @@ export class NotebookCellOutlineProvider {
dispose(): void {
// selectionListener.clear();
this._entriesDisposables.dispose();
this._dispoables.dispose();
}
@ -329,6 +330,11 @@ export class NotebookCellOutlineProvider {
};
if (this._configurationService.getValue(OutlineConfigKeys.problemsEnabled)) {
markerServiceListener.value = this._markerService.onMarkerChanged(e => {
if (notebookEditorWidget.isDisposed) {
console.error('notebook editor is disposed');
return;
}
if (e.some(uri => notebookEditorWidget.getCellsInRange().some(cell => isEqual(cell.uri, uri)))) {
doUpdateMarker(false);
this._onDidChange.fire({});