Android: Use global reference to EmulationActivity

Fixes crash when loading input profile while running.
This commit is contained in:
Connor McLaughlin 2021-03-28 12:26:08 +10:00
parent 85c5b99b7a
commit cfdddbf043
1 changed files with 4 additions and 0 deletions

View File

@ -456,6 +456,9 @@ void AndroidHostInterface::EmulationThreadEntryPoint(JNIEnv* env, jobject emulat
return;
}
emulation_activity = env->NewGlobalRef(emulation_activity);
Assert(emulation_activity != nullptr);
{
std::unique_lock<std::mutex> lock(m_mutex);
m_emulation_thread_running.store(true);
@ -499,6 +502,7 @@ void AndroidHostInterface::EmulationThreadEntryPoint(JNIEnv* env, jobject emulat
}
env->CallVoidMethod(emulation_activity, s_EmulationActivity_method_onEmulationStopped);
env->DeleteGlobalRef(emulation_activity);
}
void AndroidHostInterface::EmulationThreadLoop(JNIEnv* env)