Skip to content

Commit d7528c6

Browse files
committed
do not dispose mutabledisposble too early
1 parent 06a4015 commit d7528c6

File tree

1 file changed

+10
-14
lines changed
  • src/vs/workbench/contrib/notebook/browser/view

1 file changed

+10
-14
lines changed

src/vs/workbench/contrib/notebook/browser/view/cellPart.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,17 @@ export abstract class CellOverlayPart extends Disposable {
122122
updateForExecutionState(element: ICellViewModel, e: ICellExecutionStateChangedEvent): void { }
123123
}
124124

125-
export class CellPartsCollection implements IDisposable {
126-
private _scheduledOverlayRendering = new MutableDisposable();
127-
private _scheduledOverlayUpdateState = new MutableDisposable();
128-
private _scheduledOverlayUpdateExecutionState = new MutableDisposable();
125+
export class CellPartsCollection extends Disposable {
126+
private _scheduledOverlayRendering = this._register(new MutableDisposable());
127+
private _scheduledOverlayUpdateState = this._register(new MutableDisposable());
128+
private _scheduledOverlayUpdateExecutionState = this._register(new MutableDisposable());
129129

130130
constructor(
131131
private readonly contentParts: readonly CellContentPart[],
132132
private readonly overlayParts: readonly CellOverlayPart[]
133-
) { }
133+
) {
134+
super();
135+
}
134136

135137
concatContentPart(other: readonly CellContentPart[]): CellPartsCollection {
136138
return new CellPartsCollection(this.contentParts.concat(other), this.overlayParts);
@@ -167,9 +169,9 @@ export class CellPartsCollection implements IDisposable {
167169
part.unrenderCell(element);
168170
}
169171

170-
this._scheduledOverlayRendering?.dispose();
171-
this._scheduledOverlayUpdateState?.dispose();
172-
this._scheduledOverlayUpdateExecutionState?.dispose();
172+
this._scheduledOverlayRendering.value = undefined;
173+
this._scheduledOverlayUpdateState.value = undefined;
174+
this._scheduledOverlayUpdateExecutionState.value = undefined;
173175

174176
for (const part of this.overlayParts) {
175177
part.unrenderCell(element);
@@ -211,10 +213,4 @@ export class CellPartsCollection implements IDisposable {
211213
}
212214
});
213215
}
214-
215-
dispose() {
216-
this._scheduledOverlayRendering?.dispose();
217-
this._scheduledOverlayUpdateState?.dispose();
218-
this._scheduledOverlayUpdateExecutionState?.dispose();
219-
}
220216
}

0 commit comments

Comments
 (0)