Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exiting the app #154

Closed
zmerp opened this issue Jul 19, 2021 · 3 comments
Closed

Exiting the app #154

zmerp opened this issue Jul 19, 2021 · 3 comments
Labels
difficulty: hard Likely harder than most tasks here priority: high Vital to have status: needs discussion Direction must be ironed out type: enhancement Wouldn't this be the coolest?

Comments

@zmerp
Copy link
Contributor

zmerp commented Jul 19, 2021

When the function tagged with #[ndk_glue::main] returns, the app hangs, unless ndk_glue::native_activity().finish() is called just before. Should the ndk_glue::main append ndk_glue::native_activity().finish() at the end of the function?

@MarijnS95
Copy link
Member

@zarik5 Thanks for reporting! I have definitely been thinking about calling it after fn main():

https://github.com/rust-windowing/android-ndk-rs/blob/49e8ed51220567dccac9fd1e8baa526e9cdac163/ndk-glue/src/lib.rs#L183-L202

We can perform and publish this as a breaking change as it might potentially break an application that spawns its own thread while accidentally returning from fn main() when the app (and looper etc) is still very much alive.

@MarijnS95 MarijnS95 added difficulty: hard Likely harder than most tasks here priority: high Vital to have status: needs discussion Direction must be ironed out type: enhancement Wouldn't this be the coolest? labels Jul 26, 2021
@MarijnS95
Copy link
Member

We've had quite the discussion in #160 and automatically calling .finish() upon returning from fn main() seems undesirable at best; applications will have to call it themselves.

I'll think about how to best resolve this issue; probably by updating some examples and documentation to explicitly call this function.

korejan added a commit to korejan/ALVR that referenced this issue Sep 13, 2021
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
korejan added a commit to korejan/ALVR that referenced this issue Feb 21, 2022
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
korejan added a commit to korejan/ALVR that referenced this issue Feb 26, 2022
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
korejan added a commit to korejan/ALVR that referenced this issue Feb 28, 2022
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
korejan added a commit to korejan/ALVR that referenced this issue Mar 17, 2022
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
korejan added a commit to korejan/ALVR that referenced this issue May 4, 2022
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
@dvc94ch
Copy link
Contributor

dvc94ch commented Dec 6, 2022

closing for now, please reopen in https://github.com/rust-mobile/android-activity if still relevant

@dvc94ch dvc94ch closed this as completed Dec 6, 2022
korejan added a commit to korejan/ALVR that referenced this issue Jul 2, 2023
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
korejan added a commit to korejan/ALVR that referenced this issue Jul 8, 2023
Fixes an issue with current version of the ndk-glue library not automatically calling finish at the of an android main tagged function (more details here: rust-mobile/ndk#154)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: hard Likely harder than most tasks here priority: high Vital to have status: needs discussion Direction must be ironed out type: enhancement Wouldn't this be the coolest?
Projects
None yet
Development

No branches or pull requests

3 participants