From bc5559c1b0037ae89684b41e6113b50005f56966 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Tue, 8 Sep 2015 23:12:20 -0700 Subject: [PATCH] Allow graphics thread to self-shutdown to avoid segfault on exit --- Android/jni/jnihooks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Android/jni/jnihooks.c b/Android/jni/jnihooks.c index 6e97cbb3..60c3dd99 100644 --- a/Android/jni/jnihooks.c +++ b/Android/jni/jnihooks.c @@ -148,7 +148,7 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsInitialized(JNIEnv static bool graphicsPreviouslyInitialized = false; if (graphicsPreviouslyInitialized) { LOG("shutting down previous context"); - video_backend->shutdown(); + video_shutdown(); } graphicsPreviouslyInitialized = true; @@ -231,7 +231,6 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnQuit(JNIEnv *env, jobject c_eject_6(1); emulator_shutting_down = true; - video_shutdown(); cpu_resume(); if (pthread_join(cpu_thread_id, NULL)) { @@ -287,6 +286,7 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnKeyUp(JNIEnv *env, jobjec jlong Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnTouch(JNIEnv *env, jobject obj, jint action, jint pointerCount, jint pointerIndex, jfloatArray xCoords, jfloatArray yCoords) { //LOG(": %d/%d/%d :", action, pointerCount, pointerIndex); if (UNLIKELY(emulator_shutting_down)) { + video_shutdown(); return 0x0LL; }