void Java_org_videolan_libvlc_LibVLC_nativeDestroy(JNIEnv *env, jobject thiz) { destroy_native_crash_handler(env); releaseMediaPlayer(env, thiz); jlong libVlcInstance = getLong(env, thiz, "mLibVlcInstance"); if (!libVlcInstance) return; // Already destroyed libvlc_instance_t *instance = (libvlc_instance_t*) (intptr_t) libVlcInstance; libvlc_log_unset(instance); libvlc_release(instance); setLong(env, thiz, "mLibVlcInstance", 0); }
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *jvm, void *reserved) { JNIEnv *env; destroy_native_crash_handler(); if (jvm->GetEnv((void **) &env, JNI_VERSION)) return; env->DeleteGlobalRef(gfq.clazz); env->DeleteGlobalRef(gfq.String.clazz); env->DeleteGlobalRef(gfq.IllegalArgumentException.clazz); pthread_key_delete(jni_env_key); }