Merge pull request #81105 from SysError99/master-fix-js-mem-leak

Fix JavaScript callback memory leak issue
This commit is contained in:
Rémi Verschelde 2023-09-07 16:32:06 +02:00
commit 2cd740fd7a
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -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;