summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2023-06-24 13:27:07 +0200
committerRay <[email protected]>2023-06-24 13:27:07 +0200
commit77d025ebda31b995b3a839f781e4d193ae4c575d (patch)
tree4a4969b0b148cd42e9d96cfe2e44efab055fc581 /src
parent974460b0723c4ab550779fbc46fb88f4cf6cac41 (diff)
parentfa698fb05e7687c8a43b76d9e1ca9c6a12d99b59 (diff)
downloadraylib-77d025ebda31b995b3a839f781e4d193ae4c575d.tar.gz
raylib-77d025ebda31b995b3a839f781e4d193ae4c575d.zip
Merge branch 'master' of https://github.com/raysan5/raylib
Diffstat (limited to 'src')
-rw-r--r--src/rcore.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/rcore.c b/src/rcore.c
index 27b60ae4..d02ea2b9 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -717,17 +717,17 @@ void android_main(struct android_app *app)
char arg0[] = "raylib"; // NOTE: argv[] are mutable
CORE.Android.app = app;
- // NOTE: Return codes != 0 are skipped
- (void)main(1, (char *[]) { arg0, NULL });
+ // NOTE: We get the main return for exit()
+ int ret = main(1, (char *[]) { arg0, NULL });
- // Finish native activity
- ANativeActivity_finish(CORE.Android.app->activity);
+ // Request to end the native activity
+ ANativeActivity_finish(app->activity);
// Android ALooper_pollAll() variables
int pollResult = 0;
int pollEvents = 0;
- // Wait for app events to close
+ // Waiting for application events before complete finishing
while (!CORE.Android.app->destroyRequested)
{
while ((pollResult = ALooper_pollAll(0, NULL, &pollEvents, (void **)&CORE.Android.source)) >= 0)
@@ -736,8 +736,11 @@ void android_main(struct android_app *app)
}
}
- // WARNING: Check for deallocation and ensure no other processes are running from the application
- exit(0); // Closes the application completely without going through Java
+ // WARNING: Make sure you free resources properly and no other process is running from Java code or other.
+ // NOTE: You can use JNI to call a NativeLoader method (which will call finish() from the UI thread)
+ // to handle the full close from Java, without using exit(0) like here.
+
+ exit(ret); // Close the application directly, without going through Java
}
// NOTE: Add this to header (if apps really need it)