Skip to content

Commit 205c6a8

Browse files
authored
voice - fix some leaks (#245676)
1 parent 0fcff83 commit 205c6a8

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/vs/workbench/api/browser/mainThreadSpeech.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ export class MainThreadSpeech implements MainThreadSpeechShape {
9898
onDidChange: onDidChange.event,
9999
synthesize: async text => {
100100
await this.proxy.$synthesizeSpeech(session, text);
101-
await raceCancellation(Event.toPromise(Event.filter(onDidChange.event, e => e.status === TextToSpeechStatus.Stopped)), token);
101+
const disposable = new DisposableStore();
102+
try {
103+
await raceCancellation(Event.toPromise(Event.filter(onDidChange.event, e => e.status === TextToSpeechStatus.Stopped, disposable), disposable), token);
104+
} finally {
105+
disposable.dispose();
106+
}
102107
}
103108
};
104109
},

src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ class ChatSynthesizerSessions {
736736
const activeSession = this.activeSession = new CancellationTokenSource();
737737

738738
const disposables = new DisposableStore();
739-
activeSession.token.onCancellationRequested(() => disposables.dispose());
739+
disposables.add(activeSession.token.onCancellationRequested(() => disposables.dispose()));
740740

741741
const session = await this.speechService.createTextToSpeechSession(activeSession.token, 'chat');
742742

0 commit comments

Comments
 (0)