Skip to content

Commit

Permalink
Android: add mutex protection to onNativeOrientationChanged
Browse files Browse the repository at this point in the history
it's possible receive try to send an event between the check first for SDL_GetVideoDevice
and SDL_VideoQuit is called
  • Loading branch information
1bsyl committed Jan 16, 2019
1 parent e994be5 commit 8a19ff3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/android/SDL_android.c
Expand Up @@ -700,11 +700,15 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
JNIEnv *env, jclass jcls,
jint orientation)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
if (_this) {
SDL_LockMutex(Android_ActivityMutex);

if (Android_Window)
{
SDL_VideoDisplay *display = SDL_GetDisplay(0);
SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation);
}

SDL_UnlockMutex(Android_ActivityMutex);
}

JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)(
Expand Down

0 comments on commit 8a19ff3

Please sign in to comment.