Skip to content

Commit 45db560

Browse files
authored
Check disposal in async rendering (microsoft#218235)
Fixes microsoft#218000
1 parent 1088b76 commit 45db560

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/vs/workbench/contrib/chat/browser/codeBlockPart.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export class CodeBlockPart extends Disposable {
144144
private currentScrollWidth = 0;
145145

146146
private readonly disposableStore = this._register(new DisposableStore());
147+
private isDisposed = false;
147148

148149
constructor(
149150
private readonly options: ChatEditorOptions,
@@ -264,6 +265,11 @@ export class CodeBlockPart extends Disposable {
264265
}
265266
}
266267

268+
override dispose() {
269+
this.isDisposed = true;
270+
super.dispose();
271+
}
272+
267273
get uri(): URI | undefined {
268274
return this.editor.getModel()?.uri;
269275
}
@@ -356,6 +362,9 @@ export class CodeBlockPart extends Disposable {
356362
}
357363

358364
await this.updateEditor(data);
365+
if (this.isDisposed) {
366+
return;
367+
}
359368

360369
this.layout(width);
361370
if (editable) {

0 commit comments

Comments
 (0)