From f2fb668c9e057d30c54961f1740ad5473ec9cef5 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 9 Jan 2025 21:29:01 +0300 Subject: [PATCH] android: now run exit() from Java side, as the next engine run is expected to be clean --- .../src/main/java/su/xash/engine/XashActivity.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/app/src/main/java/su/xash/engine/XashActivity.java b/android/app/src/main/java/su/xash/engine/XashActivity.java index cf946917..ff4b8c76 100644 --- a/android/app/src/main/java/su/xash/engine/XashActivity.java +++ b/android/app/src/main/java/su/xash/engine/XashActivity.java @@ -30,6 +30,18 @@ public class XashActivity extends SDLActivity { AndroidBug5497Workaround.assistActivity(this); } + @Override + public void onDestroy() + { + super.onDestroy(); + + // Now that we don't exit from native code, we need to exit here, resetting + // application state (actually global variables that we don't cleanup on exit) + // + // When the issue with global variables will be resolved, remove that exit() call + System.exit(0); + } + @Override protected String[] getLibraries() { return new String[]{"SDL2", "xash"};