From c0afa7e621f9abd7ea32caec6d67cbdc58287789 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 28 Jan 2024 08:46:56 +1000 Subject: [PATCH] Web: Fix a possible JS error. Public issue https://github.com/mackron/miniaudio/issues/810 --- miniaudio.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index e4ded2b8..d16bb820 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -40454,6 +40454,10 @@ static ma_result ma_context_uninit__webaudio(ma_context* pContext) /* Remove the global miniaudio object from window if there are no more references to it. */ EM_ASM({ if (typeof(window.miniaudio) !== 'undefined') { + miniaudio.unlock_event_types.map(function(event_type) { + document.removeEventListener(event_type, miniaudio.unlock, true); + }); + window.miniaudio.referenceCount -= 1; if (window.miniaudio.referenceCount === 0) { delete window.miniaudio;