Fix other leaking listeners

This commit is contained in:
Daniel Imms
2020-05-03 14:37:20 -07:00
parent b75e42a56c
commit 06b8d36cf0
10 changed files with 44 additions and 16 deletions
+5 -2
View File
@@ -8,18 +8,19 @@ import { IAttributeData } from 'common/Types';
import { Buffer } from 'common/buffer/Buffer';
import { EventEmitter, IEvent } from 'common/EventEmitter';
import { IOptionsService, IBufferService } from 'common/services/Services';
import { Disposable } from 'common/Lifecycle';
/**
* The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and
* provides also utilities for working with them.
*/
export class BufferSet implements IBufferSet {
export class BufferSet extends Disposable implements IBufferSet {
private _normal: Buffer;
private _alt: Buffer;
private _activeBuffer: Buffer;
private _onBufferActivate = new EventEmitter<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}>();
private _onBufferActivate = this.register(new EventEmitter<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}>());
public get onBufferActivate(): IEvent<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}> { return this._onBufferActivate.event; }
/**
@@ -30,6 +31,8 @@ export class BufferSet implements IBufferSet {
optionsService: IOptionsService,
bufferService: IBufferService
) {
super();
this._normal = new Buffer(true, optionsService, bufferService);
this._normal.fillViewportRows();
+2 -2
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset } from 'common/Types';
import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from 'common/Types';
import { IEvent } from 'common/EventEmitter';
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
@@ -47,7 +47,7 @@ export interface IBuffer {
addMarker(y: number): IMarker;
}
export interface IBufferSet {
export interface IBufferSet extends IDisposable {
alt: IBuffer;
normal: IBuffer;
active: IBuffer;