Fixed bug 3728 - [Android] crash when shared libraries are no loaded
authorSam Lantinga
Wed, 09 Aug 2017 20:23:48 -0700
changeset 11214f8390acaa735
parent 11213 40e069d59604
child 11215 51aeabb61b2e
Fixed bug 3728 - [Android] crash when shared libraries are no loaded

Sylvain

On Android, when shared libraries are not correctly loaded (eg SDLActivity.mBrokenLibraries is true), there is a pop-up with an error message.

After user dismisses the pop-up, application crashes:
- because the native function "nativePause()" may no be loaded (if libSDL2.so is not loaded).
- because mSurface is null.
android-project/src/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/src/org/libsdl/app/SDLActivity.java	Wed Aug 09 20:20:35 2017 -0700
     1.2 +++ b/android-project/src/org/libsdl/app/SDLActivity.java	Wed Aug 09 20:23:48 2017 -0700
     1.3 @@ -265,9 +265,6 @@
     1.4      protected void onDestroy() {
     1.5          Log.v(TAG, "onDestroy()");
     1.6  
     1.7 -        mNextNativeState = NativeState.PAUSED;
     1.8 -        SDLActivity.handleNativeState();
     1.9 -
    1.10          if (SDLActivity.mBrokenLibraries) {
    1.11             super.onDestroy();
    1.12             // Reset everything in case the user re opens the app
    1.13 @@ -275,6 +272,9 @@
    1.14             return;
    1.15          }
    1.16  
    1.17 +        mNextNativeState = NativeState.PAUSED;
    1.18 +        SDLActivity.handleNativeState();
    1.19 +
    1.20          // Send a quit message to the application
    1.21          SDLActivity.mExitCalledFromJava = true;
    1.22          SDLActivity.nativeQuit();