Skip to content

Commit

Permalink
Ignore errors when terminal is disposed during fetching xterm ctor
Browse files Browse the repository at this point in the history
Fixes #135002
  • Loading branch information
Tyriar committed Nov 9, 2021
1 parent fc91670 commit dd8a099
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
if (this._fixedCols) {
await this._addScrollbar();
}
}).catch((err) => {
// Ignore exceptions if the terminal is already disposed
if (!this._isDisposed) {
throw err;
}
});

this.addDisposable(this._configurationService.onDidChangeConfiguration(async e => {
Expand Down Expand Up @@ -551,8 +556,10 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
*/
protected async _createXterm(): Promise<XtermTerminal> {
const Terminal = await this._getXtermConstructor();
if (this._isDisposed) {
throw new Error('Terminal disposed of during xterm.js creation');
}

// TODO: Move cols/rows over to XtermTerminal
const xterm = this._instantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows);
this.xterm = xterm;
const lineDataEventAddon = new LineDataEventAddon();
Expand Down

0 comments on commit dd8a099

Please sign in to comment.