mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 16:35:36 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user