mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-22 11:18:14 +00:00
Android: fix wrong state after immediate sequence pause() / resume() / pause()
It may happen to have the sequence pause()/resume()/pause(), before polling any events. Before, it ends in 'resumed' state because as the check is greedy. Now, always increase the Pause semaphore, and stop at each pause. It ends in 'paused' state. Related to bug 3250: set up a reconfiguration of SurfaceView holder. Turn the screen off manually before the app starts (repro rate is not 100%..)
This commit is contained in:
@@ -820,8 +820,10 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)(
|
||||
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
||||
|
||||
/* *After* sending the relevant events, signal the pause semaphore
|
||||
* so the event loop knows to pause and (optionally) block itself */
|
||||
if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem);
|
||||
* so the event loop knows to pause and (optionally) block itself.
|
||||
* Sometimes 2 pauses can be queued (eg pause/resume/pause), so it's
|
||||
* always increased. */
|
||||
SDL_SemPost(Android_PauseSem);
|
||||
}
|
||||
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
|
Reference in New Issue
Block a user