Skip to content

Commit

Permalink
Android: allow multiple calls to nativeResume()
Browse files Browse the repository at this point in the history
Doesn't seem to happen manually, but symetrical to the pause handling.

Can be tested by adding:

mNextNativeState = SDLActivity.NativeState.PAUSED;
handleNativeState();
mNextNativeState = SDLActivity.NativeState.RESUMED;
handleNativeState();
mNextNativeState = SDLActivity.NativeState.PAUSED;
handleNativeState();
mNextNativeState = SDLActivity.NativeState.RESUMED;
handleNativeState();

Before, it ends in 'paused' state.
Now, it ends in 'resumed' state.
  • Loading branch information
1bsyl committed Jan 6, 2019
1 parent 911f1d3 commit 9f23d18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/android/SDL_android.c
Expand Up @@ -802,7 +802,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)(
SDL_SendAppEvent(SDL_APP_TERMINATING);
/* Resume the event loop so that the app can catch SDL_QUIT which
* should now be the top event in the event queue. */
if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
SDL_SemPost(Android_ResumeSem);
}

/* Pause */
Expand Down Expand Up @@ -853,7 +853,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)(
* We can't restore the GL Context here because it needs to be done on the SDL main thread
* and this function will be called from the Java thread instead.
*/
if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
SDL_SemPost(Android_ResumeSem);
}

SDL_UnlockMutex(Android_ActivityMutex);
Expand Down

0 comments on commit 9f23d18

Please sign in to comment.