From 3e0c7d18e50d89abf4c0523fc22cae6495d5b71d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 27 May 2026 19:35:58 +0000 Subject: [PATCH] Register WriteBuffer cleanup via toDisposable in constructor Co-authored-by: Daniel Imms --- src/common/input/WriteBuffer.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/common/input/WriteBuffer.ts b/src/common/input/WriteBuffer.ts index f606c8655..7ecab58ad 100644 --- a/src/common/input/WriteBuffer.ts +++ b/src/common/input/WriteBuffer.ts @@ -5,7 +5,7 @@ */ import { TimeoutTimer } from 'common/Async'; -import { Disposable } from 'common/Lifecycle'; +import { Disposable, toDisposable } from 'common/Lifecycle'; import { Emitter } from 'common/Event'; const enum Constants { @@ -48,17 +48,12 @@ export class WriteBuffer extends Disposable { constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise) { super(); - } - - public override dispose(): void { - if (this._store.isDisposed) { - return; - } - this._writeBuffer.length = 0; - this._callbacks.length = 0; - this._pendingData = 0; - this._bufferOffset = 0; - super.dispose(); + this._register(toDisposable(() => { + this._writeBuffer.length = 0; + this._callbacks.length = 0; + this._pendingData = 0; + this._bufferOffset = 0; + })); } public handleUserInput(): void {