mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Kill process if Cocos2dxActivity.onDestroy is invoked to resolve crash if app goes to background for a long time and Activity is recycled by system. (#1027)
This commit is contained in:
@@ -260,6 +260,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
Log.d(TAG, "Cocos2dxActivity onCreate: " + this + ", savedInstanceState: " + savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||
@@ -354,6 +355,11 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
||||
Cocos2dxAudioFocusManager.unregisterAudioFocusListener(this);
|
||||
CAAgent.onDestroy();
|
||||
super.onDestroy();
|
||||
|
||||
Log.d(TAG, "Cocos2dxActivity onDestroy: " + this + ", mGLSurfaceView" + mGLSurfaceView);
|
||||
if (mGLSurfaceView != null) {
|
||||
Cocos2dxHelper.terminateProcess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user