Skip to content

Commit

Permalink
Android: check SDL is initialized before sending the event
Browse files Browse the repository at this point in the history
Avoid error message:
SDLActivity thread ends (error=Video subsystem has not been initialized)
  • Loading branch information
1bsyl committed Mar 13, 2019
1 parent 82758ef commit 063c0c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/android/SDL_android.c
Expand Up @@ -741,7 +741,12 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
SDL_LockMutex(Android_ActivityMutex);

displayOrientation = (SDL_DisplayOrientation)orientation;
SDL_SendDisplayEvent(SDL_GetDisplay(0), SDL_DISPLAYEVENT_ORIENTATION, orientation);

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

SDL_UnlockMutex(Android_ActivityMutex);
}
Expand Down

0 comments on commit 063c0c2

Please sign in to comment.