mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Fix local reference table overflow error problem. (#1178)
* Fix local reference table error problem. * Modify the patch according to review comment. * Fix a variable name.
This commit is contained in:
@@ -508,6 +508,7 @@ static bool JavaScriptJavaBridge_callStaticMethod(se::State& s)
|
||||
{
|
||||
int count = argc - 3;
|
||||
jvalue* jargs = new jvalue[count];
|
||||
std::vector<jobject> toReleaseObjects;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
int index = i + 3;
|
||||
@@ -544,10 +545,15 @@ static bool JavaScriptJavaBridge_callStaticMethod(se::State& s)
|
||||
std::string str;
|
||||
seval_to_std_string(args[index], &str);
|
||||
jargs[i].l = call.getEnv()->NewStringUTF(str.c_str());
|
||||
toReleaseObjects.push_back(jargs[i].l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ok = call.executeWithArgs(jargs);
|
||||
for (const auto& obj : toReleaseObjects)
|
||||
{
|
||||
call.getEnv()->DeleteLocalRef(obj);
|
||||
}
|
||||
if (jargs)
|
||||
delete[] jargs;
|
||||
int errorCode = call.getErrorCode();
|
||||
|
||||
Reference in New Issue
Block a user