]> git.bitcoin.ninja Git - ldk-java/commitdiff
Do not cast JavaEnv to void** for AttachCurrentThread on Android
authorMatt Corallo <git@bluematt.me>
Sat, 12 Jun 2021 16:50:21 +0000 (16:50 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 12 Jun 2021 16:59:19 +0000 (16:59 +0000)
java_strings.py

index e00f513f717a97dc1f76a9f25c8964019b21299d..3d5a2a0150cd1c5680d6a51495e27183a93e5ba9 100644 (file)
@@ -457,7 +457,10 @@ import java.util.Arrays;
         res =  "JNIEnv *env;\n"
         res += "jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);\n"
         res += "if (get_jenv_res == JNI_EDETACHED) {\n"
-        res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);\n"
+        if self.target == Target.ANDROID:
+            res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, &env, NULL) == JNI_OK);\n"
+        else:
+            res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);\n"
         res += "} else {\n"
         res += "\tDO_ASSERT(get_jenv_res == JNI_OK);\n"
         res += "}\n"