From 9f23d1815f30e72e395bd0a11c751b55ded94320 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Sun, 6 Jan 2019 17:35:42 +0100 Subject: [PATCH] Android: allow multiple calls to nativeResume() 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. --- src/core/android/SDL_android.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index ad305229b..1cebed399 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -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 */ @@ -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);