mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-08-15 05:27:32 +00:00
Allow graphics thread to self-shutdown to avoid segfault on exit
This commit is contained in:
@@ -148,7 +148,7 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsInitialized(JNIEnv
|
|||||||
static bool graphicsPreviouslyInitialized = false;
|
static bool graphicsPreviouslyInitialized = false;
|
||||||
if (graphicsPreviouslyInitialized) {
|
if (graphicsPreviouslyInitialized) {
|
||||||
LOG("shutting down previous context");
|
LOG("shutting down previous context");
|
||||||
video_backend->shutdown();
|
video_shutdown();
|
||||||
}
|
}
|
||||||
graphicsPreviouslyInitialized = true;
|
graphicsPreviouslyInitialized = true;
|
||||||
|
|
||||||
@@ -231,7 +231,6 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnQuit(JNIEnv *env, jobject
|
|||||||
c_eject_6(1);
|
c_eject_6(1);
|
||||||
|
|
||||||
emulator_shutting_down = true;
|
emulator_shutting_down = true;
|
||||||
video_shutdown();
|
|
||||||
|
|
||||||
cpu_resume();
|
cpu_resume();
|
||||||
if (pthread_join(cpu_thread_id, NULL)) {
|
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) {
|
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);
|
//LOG(": %d/%d/%d :", action, pointerCount, pointerIndex);
|
||||||
if (UNLIKELY(emulator_shutting_down)) {
|
if (UNLIKELY(emulator_shutting_down)) {
|
||||||
|
video_shutdown();
|
||||||
return 0x0LL;
|
return 0x0LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user