Skip to content

Commit

Permalink
Android: some simplification, don't need mExitCalledFromJava
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Jan 10, 2019
1 parent 66fbfe1 commit 5c11e5e
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
Expand Up @@ -70,8 +70,6 @@ public enum NativeState {
public static NativeState mNextNativeState;
public static NativeState mCurrentNativeState;

public static boolean mExitCalledFromJava;

/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
public static boolean mBrokenLibraries;

Expand Down Expand Up @@ -179,7 +177,6 @@ public static void initialize() {
mCursors = new Hashtable<Integer, PointerIcon>();
mLastCursorID = 0;
mSDLThread = null;
mExitCalledFromJava = false;
mBrokenLibraries = false;
mIsResumedCalled = false;
mIsSurfaceReady = false;
Expand Down Expand Up @@ -390,8 +387,6 @@ protected void onDestroy() {
return;
}

SDLActivity.mExitCalledFromJava = true;

if (SDLActivity.mSDLThread != null) {

// Send Quit event to "SDLThread" thread
Expand Down Expand Up @@ -514,15 +509,6 @@ public static void handleNativeState() {
}
}

/* The native thread has finished */
public static void handleNativeExit() {
SDLActivity.mSDLThread = null;
if (mSingleton != null) {
mSingleton.finish();
}
}


// Messages from the SDLMain thread
static final int COMMAND_CHANGE_TITLE = 1;
static final int COMMAND_CHANGE_WINDOW_STYLE = 2;
Expand Down Expand Up @@ -1513,9 +1499,12 @@ public void run() {

Log.v("SDL", "Finished main function");

// Native thread has finished, let's finish the Activity
if (!SDLActivity.mExitCalledFromJava) {
SDLActivity.handleNativeExit();
if (SDLActivity.mSingleton.isFinishing()) {
// Activity is already being destroyed
} else {
// Let's finish the Activity
SDLActivity.mSDLThread = null;
SDLActivity.mSingleton.finish();
}
}
}
Expand Down

0 comments on commit 5c11e5e

Please sign in to comment.