mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-15 07:48:14 +00:00
Android: potential ANR during onKeyDown/Up
SDLActivity may call onNativeKeyDown, while application is quitting
This commit is contained in:
@@ -1157,7 +1157,13 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)(
|
|||||||
JNIEnv *env, jclass jcls,
|
JNIEnv *env, jclass jcls,
|
||||||
jint keycode)
|
jint keycode)
|
||||||
{
|
{
|
||||||
Android_OnKeyDown(keycode);
|
SDL_LockMutex(Android_ActivityMutex);
|
||||||
|
|
||||||
|
if (Android_Window) {
|
||||||
|
Android_OnKeyDown(keycode);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keyup */
|
/* Keyup */
|
||||||
@@ -1165,7 +1171,13 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)(
|
|||||||
JNIEnv *env, jclass jcls,
|
JNIEnv *env, jclass jcls,
|
||||||
jint keycode)
|
jint keycode)
|
||||||
{
|
{
|
||||||
Android_OnKeyUp(keycode);
|
SDL_LockMutex(Android_ActivityMutex);
|
||||||
|
|
||||||
|
if (Android_Window) {
|
||||||
|
Android_OnKeyUp(keycode);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Virtual keyboard return key might stop text input */
|
/* Virtual keyboard return key might stop text input */
|
||||||
|
Reference in New Issue
Block a user