mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-31 00:09:19 +01:00
Android: be sure shared libraries are loaded in onConfigurationChanged()
This could fix a rare crash if: - onConfigurationChanged is called before onCreate(); or shared libraries failed to load and onConfigurationChanged() is called
This commit is contained in:
parent
955f3184f9
commit
7ad71563ce
@ -71,7 +71,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
public static NativeState mCurrentNativeState;
|
public static NativeState mCurrentNativeState;
|
||||||
|
|
||||||
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
||||||
public static boolean mBrokenLibraries;
|
public static boolean mBrokenLibraries = true;
|
||||||
|
|
||||||
// Main components
|
// Main components
|
||||||
protected static SDLActivity mSingleton;
|
protected static SDLActivity mSingleton;
|
||||||
@ -174,7 +174,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
mCursors = new Hashtable<Integer, PointerIcon>();
|
mCursors = new Hashtable<Integer, PointerIcon>();
|
||||||
mLastCursorID = 0;
|
mLastCursorID = 0;
|
||||||
mSDLThread = null;
|
mSDLThread = null;
|
||||||
mBrokenLibraries = false;
|
|
||||||
mIsResumedCalled = false;
|
mIsResumedCalled = false;
|
||||||
mHasFocus = true;
|
mHasFocus = true;
|
||||||
mNextNativeState = NativeState.INIT;
|
mNextNativeState = NativeState.INIT;
|
||||||
@ -199,6 +198,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
String errorMsgBrokenLib = "";
|
String errorMsgBrokenLib = "";
|
||||||
try {
|
try {
|
||||||
loadLibraries();
|
loadLibraries();
|
||||||
|
mBrokenLibraries = false; /* success */
|
||||||
} catch(UnsatisfiedLinkError e) {
|
} catch(UnsatisfiedLinkError e) {
|
||||||
System.err.println(e.getMessage());
|
System.err.println(e.getMessage());
|
||||||
mBrokenLibraries = true;
|
mBrokenLibraries = true;
|
||||||
@ -420,6 +420,10 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
Log.v(TAG, "onConfigurationChanged()");
|
Log.v(TAG, "onConfigurationChanged()");
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
|
if (SDLActivity.mBrokenLibraries) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mCurrentLocale == null || !mCurrentLocale.equals(newConfig.locale)) {
|
if (mCurrentLocale == null || !mCurrentLocale.equals(newConfig.locale)) {
|
||||||
mCurrentLocale = newConfig.locale;
|
mCurrentLocale = newConfig.locale;
|
||||||
SDLActivity.onNativeLocaleChanged();
|
SDLActivity.onNativeLocaleChanged();
|
||||||
|
Loading…
Reference in New Issue
Block a user