diff options
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
| -rw-r--r-- | Source/Android/jni/MainAndroid.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 7902a9973f..01728ce014 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -195,26 +195,18 @@ std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core static bool MsgAlert(const char* caption, const char* text, bool yes_no, Common::MsgType style) { - // If a panic alert happens very early in the execution of a game, we can crash here with - // the error "JNI NewString called with pending exception java.lang.StackOverflowError". - // As a workaround, let's put the call on a new thread with a brand new stack. - - jboolean result; - - std::thread([&] { - JNIEnv* env = IDCache::GetEnvForThread(); + JNIEnv* env = IDCache::GetEnvForThread(); - jstring j_caption = ToJString(env, caption); - jstring j_text = ToJString(env, text); + jstring j_caption = ToJString(env, caption); + jstring j_text = ToJString(env, text); - // Execute the Java method. - result = env->CallStaticBooleanMethod( - IDCache::GetNativeLibraryClass(), IDCache::GetDisplayAlertMsg(), j_caption, j_text, yes_no, - style == Common::MsgType::Warning, s_need_nonblocking_alert_msg); + // Execute the Java method. + jboolean result = env->CallStaticBooleanMethod( + IDCache::GetNativeLibraryClass(), IDCache::GetDisplayAlertMsg(), j_caption, j_text, yes_no, + style == Common::MsgType::Warning, s_need_nonblocking_alert_msg); - env->DeleteLocalRef(j_caption); - env->DeleteLocalRef(j_text); - }).join(); + env->DeleteLocalRef(j_caption); + env->DeleteLocalRef(j_text); return result != JNI_FALSE; } |
