Register WriteBuffer cleanup via toDisposable in constructor
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
co-authored by
Daniel Imms
parent
7499a2181d
commit
3e0c7d18e5
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TimeoutTimer } from 'common/Async';
|
import { TimeoutTimer } from 'common/Async';
|
||||||
import { Disposable } from 'common/Lifecycle';
|
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||||
import { Emitter } from 'common/Event';
|
import { Emitter } from 'common/Event';
|
||||||
|
|
||||||
const enum Constants {
|
const enum Constants {
|
||||||
@@ -48,17 +48,12 @@ export class WriteBuffer extends Disposable {
|
|||||||
|
|
||||||
constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) {
|
constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) {
|
||||||
super();
|
super();
|
||||||
}
|
this._register(toDisposable(() => {
|
||||||
|
this._writeBuffer.length = 0;
|
||||||
public override dispose(): void {
|
this._callbacks.length = 0;
|
||||||
if (this._store.isDisposed) {
|
this._pendingData = 0;
|
||||||
return;
|
this._bufferOffset = 0;
|
||||||
}
|
}));
|
||||||
this._writeBuffer.length = 0;
|
|
||||||
this._callbacks.length = 0;
|
|
||||||
this._pendingData = 0;
|
|
||||||
this._bufferOffset = 0;
|
|
||||||
super.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleUserInput(): void {
|
public handleUserInput(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user