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
This commit is contained in:
Sylvain Becker
2019-01-17 11:05:05 +01:00
parent 6690a46941
commit e5f8801f55
4 changed files with 63 additions and 44 deletions

View File

@@ -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();