| Summary: | No graceful exit on Androids | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Peter Jankuliak <p.jankuliak> |
| Component: | main | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | gabomdq, martin, p.jankuliak |
| Version: | 2.0.1 | ||
| Hardware: | All | ||
| OS: | Android (All) | ||
|
Description
Peter Jankuliak
2014-02-02 18:38:29 UTC
1) We recommend that you don't call exit from native code. This will terminate both the native and Java threads immediately. 2) We call SDLActivity.finish here: https://hg.libsdl.org/SDL/file/b9b66e0a8250/android-project/src/org/libsdl/app/SDLActivity.java#l182 Having said that, and assuming you are using the default SDLActivity.java and that you are exiting your native loop *without* calling exit, what's the buggy behaviour you are experiencing? I have previously only tested with the 2.0.1 release, where the SDLActivity.finish wasn't called. When I inspected the latest code in mercurial I've missed the trick with another thread waiting for the main one to join and then calling the SDLActivity.finish function. So I've now tested with the latest code from the repo and the issue seems to have been resolved. For completeness I'll try to describe the buggy behavior in 2.0.1 Say an SDL application is running its main loop and renders to screen. Then for some reason (e.g. user pressed an 'in-game' quit button) the main loop finishes and SDL_main quits without calling the the exit function. Now we're in a state where the SDLActivity doesn't know the main loop has ended and is still pushing events to the SDL event queue. The latest frame from when the main loop was still running is still on the screen but nothing ever happens from this point on so the app appears frozen. Regards Awesome, thanks! |