Correctly dispose of Renderer and ScreenDprMonitor

This commit is contained in:
Daniel Imms
2018-06-21 10:49:03 +10:00
parent 5adf962eb5
commit ede1d5f7c8
5 changed files with 18 additions and 3 deletions
+2
View File
@@ -611,6 +611,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
this._screenDprMonitor = new ScreenDprMonitor();
this._screenDprMonitor.setListener(() => this.emit('dprchange', window.devicePixelRatio));
this.register(this._screenDprMonitor);
// Create main element container
this.element = this._document.createElement('div');
@@ -671,6 +672,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
case 'dom': this.renderer = new DomRenderer(this, this.options.theme); break;
default: throw new Error(`Unrecognized rendererType "${this.options.rendererType}"`);
}
this.register(this.renderer);
this.options.theme = null;
this.viewport = new Viewport(this, this._viewportElement, this._viewportScrollArea, this.charMeasure);
this.viewport.onThemeChanged(this.renderer.colorManager.colors);