app/internal/window: don't rely on JNI_OnCreate for getting the JavaVM

We're about to remove the global JNI_OnLoad constructor, and the
JavaVM singleton is just as easily fetched from a Java JNI callback.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-05 18:55:14 +02:00
parent c7c5b87264
commit 0c0a22bee7
3 changed files with 8 additions and 7 deletions
+4 -2
View File
@@ -10,8 +10,6 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return -1;
}
setJVM(vm);
jclass viewClass = (*env)->FindClass(env, "org/gioui/GioView");
if (viewClass == NULL) {
return -1;
@@ -105,6 +103,10 @@ jint gio_jni_GetEnv(JavaVM *vm, JNIEnv **env, jint version) {
return (*vm)->GetEnv(vm, (void **)env, version);
}
jint gio_jni_GetJavaVM(JNIEnv *env, JavaVM **jvm) {
return (*env)->GetJavaVM(env, jvm);
}
jint gio_jni_AttachCurrentThread(JavaVM *vm, JNIEnv **p_env, void *thr_args) {
return (*vm)->AttachCurrentThread(vm, p_env, thr_args);
}