Fix leaking web workers when recording new audio message

See [#5250][0].

[0]: https://github.com/signalapp/Signal-Desktop/pull/5250
This commit is contained in:
David Sanders 2021-05-13 10:49:34 -05:00 committed by Scott Nonnenberg
parent 95baa3e02e
commit de63d9d71f
1 changed files with 4 additions and 0 deletions

View File

@ -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) {