Skip to content

Commit

Permalink
Remove leak in notebook diff editor (#241739)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Feb 24, 2025
1 parent a841f40 commit c694759
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,9 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
this._list.updateElementHeight2(cell, height);
};

if (this.pendingLayouts.has(cell)) {
this.pendingLayouts.get(cell)!.dispose();
let disposable = this.pendingLayouts.get(cell);
if (disposable) {
this._localStore.delete(disposable);
}

let r: () => void;
Expand All @@ -680,11 +681,13 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
relayout(cell, height);
r();
});

this.pendingLayouts.set(cell, toDisposable(() => {
disposable = toDisposable(() => {
layoutDisposable.dispose();
r();
}));
});
this._localStore.add(disposable);

this.pendingLayouts.set(cell, disposable);

return new Promise<void>(resolve => { r = resolve; });
}
Expand Down

0 comments on commit c694759

Please sign in to comment.