From de63d9d71f92f3aa8cb3fbdc150181fae0eb61e3 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Thu, 13 May 2021 10:49:34 -0500 Subject: [PATCH] Fix leaking web workers when recording new audio message See [#5250][0]. [0]: https://github.com/signalapp/Signal-Desktop/pull/5250 --- js/views/recorder_view.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/views/recorder_view.js b/js/views/recorder_view.js index a982f9f4ff..3cb31bc80b 100644 --- a/js/views/recorder_view.js +++ b/js/views/recorder_view.js @@ -58,6 +58,10 @@ if (this.recorder.isRecording()) { this.recorder.cancelRecording(); } + + // Reach in and terminate the web worker used by WebAudioRecorder, otherwise + // it gets leaked due to a reference cycle with its onmessage listener + this.recorder.worker.terminate(); this.recorder = null; if (this.interval) {