From 55ae5b0a7806144a59cd39febd4be7e0c4a95dd8 Mon Sep 17 00:00:00 2001 From: SysError99 Date: Tue, 29 Aug 2023 13:57:44 +0700 Subject: [PATCH] Fix JavaScript callback memory leak issue Typo fix (cherry picked from commit 6a90164a0319276133a809bd32c366dd5d4c33d4) --- platform/web/js/libs/library_godot_javascript_singleton.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/web/js/libs/library_godot_javascript_singleton.js b/platform/web/js/libs/library_godot_javascript_singleton.js index 1f3633461ba..cbe59230ee1 100644 --- a/platform/web/js/libs/library_godot_javascript_singleton.js +++ b/platform/web/js/libs/library_godot_javascript_singleton.js @@ -210,7 +210,9 @@ const GodotJSWrapper = { // This is safe! JavaScript is single threaded (and using it in threads is not a good idea anyway). GodotJSWrapper.cb_ret = null; const args = Array.from(arguments); - func(p_ref, GodotJSWrapper.get_proxied(args), args.length); + const argsProxy = GodotJSWrapper.MyProxy(args); + func(p_ref, argsProxy.get_id(), args.length); + argsProxy.unref(); const ret = GodotJSWrapper.cb_ret; GodotJSWrapper.cb_ret = null; return ret;