Skip to content

Commit

Permalink
Fix possible exception when disposing terminal
Browse files Browse the repository at this point in the history
Fixes #4757
  • Loading branch information
Tyriar committed Sep 10, 2023
1 parent cfced0c commit cc43fe5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/browser/services/RenderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,14 @@ export class RenderService extends Disposable implements IRenderService {

public setRenderer(renderer: IRenderer): void {
this._renderer.value = renderer;
this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));
// If the value was not set, the terminal is being disposed so ignore it
if (this._renderer.value) {
this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));

// Force a refresh
this._needsSelectionRefresh = true;
this._fullRefresh();
// Force a refresh
this._needsSelectionRefresh = true;
this._fullRefresh();
}
}

public addRefreshCallback(callback: FrameRequestCallback): number {
Expand Down

0 comments on commit cc43fe5

Please sign in to comment.