Delete reference deletion lines and add forced exit to try to get around bug some users report on app switch

This commit is contained in:
amwatson 2024-05-10 16:27:06 -05:00
parent 2446bc329a
commit 15b41d8421
2 changed files with 4 additions and 2 deletions

View file

@ -249,7 +249,7 @@ void UILayer::Shutdown() {
mVrUILayerClass = nullptr;
// These steps are not strictly necessary for app shutdown, as references are cleaned up when
// the JVM is destroyed, but memory-saving if this class is destroyed/re-initialized at runtime.
mEnv->DeleteLocalRef(mVrUILayerObject);
// mEnv->DeleteLocalRef(mVrUILayerObject);
mVrUILayerObject = nullptr;
}

View file

@ -1264,7 +1264,9 @@ Java_org_citra_citra_1emu_vr_VrActivity_nativeOnCreate(JNIEnv* env, jobject thiz
}
extern "C" JNIEXPORT void JNICALL
Java_org_citra_citra_1emu_vr_VrActivity_nativeOnDestroy(JNIEnv* env, jobject thiz, jlong handle) {
// Ensures a clean exit. This is currently not needed for proper cleanup, but may avoid the
// crash on program switch some have reported.
exit(0);
ALOGI("nativeOnDestroy {}", static_cast<long>(handle));
if (handle != 0) { delete VRAppHandle(handle).p; }
VR::JNI::CleanupJNI(env);