diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-03-09 20:48:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 20:48:45 +0100 |
commit | 33c907f9f5b3ec1a43d0251d7cac80da49b5b658 (patch) | |
tree | 6adb187024a8de7ed0b2ebf3e7c75ae07d8407bf /platform/android/java_godot_lib_jni.cpp | |
parent | f17c5501eb4bb6a86d9f2f07567da081eb8991b0 (diff) | |
parent | 21637dfc2535a00f531b8b664c1e66ba34d11eb0 (diff) |
Merge pull request #58929 from reduz/remove-variant-arg-macros
Remove VARIANT_ARG* macros
Diffstat (limited to 'platform/android/java_godot_lib_jni.cpp')
-rw-r--r-- | platform/android/java_godot_lib_jni.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index dd4fa9de7b..249717921f 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -446,7 +446,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en } Callable::CallError err; - obj->call(str_method, (const Variant **)vptr, count, err); + obj->callp(str_method, (const Variant **)vptr, count, err); // something env->PopLocalFrame(nullptr); @@ -462,18 +462,20 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv * String str_method = jstring_to_string(method, env); int count = env->GetArrayLength(params); - Variant args[VARIANT_ARG_MAX]; - for (int i = 0; i < MIN(count, VARIANT_ARG_MAX); i++) { + Variant *args = (Variant *)alloca(sizeof(Variant) * count); + const Variant **argptrs = (const Variant **)alloca(sizeof(Variant *) * count); + + for (int i = 0; i < count; i++) { jobject obj = env->GetObjectArrayElement(params, i); if (obj) { args[i] = _jobject_to_variant(env, obj); } env->DeleteLocalRef(obj); + argptrs[i] = &args[i]; } - static_assert(VARIANT_ARG_MAX == 8, "This code needs to be updated if VARIANT_ARG_MAX != 8"); - obj->call_deferred(str_method, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); + MessageQueue::get_singleton()->push_callp(obj, str_method, (const Variant **)argptrs, count); // something env->PopLocalFrame(nullptr); } |