From a211a2e84e3f69d511a43e8673b6beda779c6a12 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Thu, 28 Mar 2013 17:19:24 +0100
Subject: NewtBaseActivity: Perform cleanup() even on onCreate() due to
possible call w/ initialized states (App process is killed for memory
exhaustion etc)
.. even though I was not able to reproduce this case, it will not harm.
---
.../newt/driver/android/NewtBaseActivity.java | 65 ++++++++++++++++++----
1 file changed, 55 insertions(+), 10 deletions(-)
(limited to 'src')
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
index ab8fc8ad0..3716e3569 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
@@ -327,32 +327,40 @@ public class NewtBaseActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
- Log.d(MD.TAG, "onCreate");
+ Log.d(MD.TAG, "onCreate.0");
if(!isDelegatedActivity()) {
super.onCreate(savedInstanceState);
}
+ // Extraordinary cleanup, for cases of 'onCreate()' calls w/ valid states,
+ // i.e. w/o having onDestroy() being called.
+ // Could happened due to spec when App process is killed for memory exhaustion or other reasons.
+ cleanup();
+
jogamp.common.os.android.StaticContext.init(rootActivity.getApplicationContext());
+ Log.d(MD.TAG, "onCreate.X");
}
@Override
public void onStart() {
- Log.d(MD.TAG, "onStart");
+ Log.d(MD.TAG, "onStart.0");
if(!isDelegatedActivity()) {
super.onStart();
}
+ Log.d(MD.TAG, "onStart.X");
}
@Override
public void onRestart() {
- Log.d(MD.TAG, "onRestart");
+ Log.d(MD.TAG, "onRestart.0");
if(!isDelegatedActivity()) {
super.onRestart();
}
+ Log.d(MD.TAG, "onRestart.X");
}
@Override
public void onResume() {
- Log.d(MD.TAG, "onResume");
+ Log.d(MD.TAG, "onResume.0");
if(!isDelegatedActivity()) {
super.onResume();
}
@@ -364,11 +372,12 @@ public class NewtBaseActivity extends Activity {
}
}
startAnimation(true);
+ Log.d(MD.TAG, "onResume.X");
}
@Override
public void onPause() {
- Log.d(MD.TAG, "onPause");
+ Log.d(MD.TAG, "onPause.0");
if( !getActivity().isFinishing() ) {
int ok=0, fail=0;
for(int i=0; i
+ * Cleaning and destroying up all preserved GLEventListenerState
+ * and clearing the preserve-flag of all GLStateKeeper.
+ *
+ *
+ * Destroying all GLWindow.
+ *
+ */
+ private void cleanup() {
+ Log.d(MD.TAG, "cleanup.0");
+ int glelsKilled = 0, glelsClean = 0;
+ for(int i=0; i