Parcourir la source

fixed crash due to orientation change or call of onDestroy()

Martin Felis il y a 12 ans
Parent
commit
eaf4e6d8b2
2 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 1 1
      AndroidManifest.xml
  2. 6 0
      src/org/libsdl/app/SDLActivity.java

+ 1 - 1
AndroidManifest.xml

@@ -11,7 +11,7 @@
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
         <activity android:name="GameActivity"
         <activity android:name="GameActivity"
                   android:label="Löve for Android"
                   android:label="Löve for Android"
-                  android:screenOrientation="landscape">
+                  android:screenOrientation="unspecified">
             <intent-filter>
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
                 <category android:name="android.intent.category.LAUNCHER" />

+ 6 - 0
src/org/libsdl/app/SDLActivity.java

@@ -109,6 +109,12 @@ public class SDLActivity extends Activity {
     protected void onDestroy() {
     protected void onDestroy() {
         super.onDestroy();
         super.onDestroy();
         Log.v("SDL", "onDestroy()");
         Log.v("SDL", "onDestroy()");
+        
+        if (!isFinishing()) {
+            Log.v("SDL", "Not quitting native app as isFinishing() is false");
+        	return;
+        }
+        
         // Send a quit message to the application
         // Send a quit message to the application
         SDLActivity.nativeQuit();
         SDLActivity.nativeQuit();