diff options
author | Sylvain Becker <sylvain.becker@gmail.com> | 2019-01-17 11:05:05 +0100 |
---|---|---|
committer | Sylvain Becker <sylvain.becker@gmail.com> | 2019-01-17 11:05:05 +0100 |
commit | d9931045f246d358858662a3ac04194900dcfbe3 (patch) | |
tree | 7f5389fb4a1b66071e447a4f9bfa516e65b30b60 /android-project/app | |
parent | 9a1a6cec9d1f12694f3daa630fff8c7315294d8d (diff) |
Android: prevent concurrency in Android_SetScreenResolution() when exiting
by checking Android_Window validity
- SDLThread: user application is exiting:
SDL_VideoQuit() and clearing SDL_GetVideoDevice()
- ActivityThread is changing orientation/size
surfaceChanged() > Android_SetScreenResolution() > SDL_GetVideoDevice()
- Separate function into Android_SetScreenResolution() and Android_SendResize(),
formating, and mark Android_DeviceWidth/Heigh as static
Diffstat (limited to 'android-project/app')
-rw-r--r-- | android-project/app/src/main/java/org/libsdl/app/SDLActivity.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 21a79f6853..b7de0917c6 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -723,7 +723,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh public static native void nativePause(); public static native void nativeResume(); public static native void onNativeDropFile(String filename); - public static native void onNativeResize(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, int format, float rate); + public static native void nativeSetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, int format, float rate); + public static native void onNativeResize(); public static native void onNativeKeyDown(int keycode); public static native void onNativeKeyUp(int keycode); public static native void onNativeKeyboardFocusLost(); @@ -1652,7 +1653,8 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, Log.v("SDL", "Window size: " + width + "x" + height); Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight); - SDLActivity.onNativeResize(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate()); + SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate()); + SDLActivity.onNativeResize(); boolean skip = false; int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation(); |