Skip to content

Commit 3294dc5

Browse files
fix: detach event listeners during stream and crossfade destroy
Remove all event listeners from CrossfadeController and pipeline transforms on stream destruction to prevent closure retention.
1 parent a825121 commit 3294dc5

4 files changed

Lines changed: 5 additions & 0 deletions

File tree

dist/src/playback/processing/CrossfadeController.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ export class CrossfadeController extends Transform {
377377
this.transition = null;
378378
this.armed = null;
379379
this.mainPending = null;
380+
this.removeAllListeners();
380381
callback(error);
381382
}
382383
_createBufferedStream(stream, maxBytes, onComplete) {

dist/src/playback/processing/streamProcessor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ class BaseAudioResource {
514514
pipe.abort?.();
515515
pipe.unpipe?.();
516516
pipe.cleanup?.();
517+
pipe.removeAllListeners?.();
517518
pipe.destroy?.();
518519
}
519520
this.pipes.length = 0;

src/playback/processing/CrossfadeController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ export class CrossfadeController extends Transform {
623623
this.transition = null
624624
this.armed = null
625625
this.mainPending = null
626+
this.removeAllListeners()
626627
callback(error)
627628
}
628629

src/playback/processing/streamProcessor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,12 +779,14 @@ class BaseAudioResource {
779779
abort?: () => void
780780
unpipe?: () => void
781781
cleanup?: () => void
782+
removeAllListeners?: () => void
782783
destroy?: () => void
783784
}
784785
pipe.resume?.()
785786
pipe.abort?.()
786787
pipe.unpipe?.()
787788
pipe.cleanup?.()
789+
pipe.removeAllListeners?.()
788790
pipe.destroy?.()
789791
}
790792

0 commit comments

Comments
 (0)