Android: fix call of glFinish without context.

Message in the log, when going to background:
"call to OpenGL ES API with no current context (logged once per thread)"

Because of SDL_WINDOWEVENT_MINIMIZED is sent from the Java Activity thread.
It calls SDL_RendererEventWatch(), _WindowEvent() and glFinish() without context.

Solution is to move sending of SDL_WINDOWEVENT_MINIMIZED to the SDL thread.
This commit is contained in:
Sylvain Becker
2019-12-21 21:18:02 +01:00
parent f3a547d00a
commit 45a9b5fa2e
2 changed files with 19 additions and 14 deletions

View File

@@ -1162,23 +1162,11 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)(
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)(
JNIEnv *env, jclass cls)
{
SDL_LockMutex(Android_ActivityMutex);
__android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()");
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
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.
* Sometimes 2 pauses can be queued (eg pause/resume/pause), so it's
* always increased. */
/* Signal the pause semaphore 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);
}
/* Resume */