You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.1 Reported for operating system, platform: Android (All), All
Comments on the original bug report:
On 2014-02-02 19:23:45 +0000, Peter Jankuliak wrote:
To reproduce:
Open log output and start a SDL application
Pres the Home button
When in home screen, press and hold the home button till task manager shows up
Kill your application using swipe gesture
Observe in the log output that after few seconds the system terminates
your app because it is not responding.
The issue is mostly annoying when app needs to run other services or do service cleanup after the main activity exits.
The freeze happens inside the SDLActivity.onDestroy function on line:
SDLActivity.mSDLThread.join()
and the reason is this:
When app goes to background, the call to SDL_PollEvent causes the main thread
to block for reasons explained in README-android.txt. This block is only
released when app goes back to foreground, which is when
SDLActivity.handleResume is called (not when a new message arrives!).
However, when SDL_PollEvent is blocked, it won't receive any messages pushed to
it using the SDL_PushEvent, so the line:
SDLActivity.nativeQuit() // which pushes SDL_QUIT message to the message queue
has no effect.
I'm guessing the proper solution would be to unblock SDL_PollEvent when a
message arrives in the queue. But as a fast workaround I propose to put this
code:
if (SDLActivity.mIsPaused) {
SDLActivity.mIsPaused = false;
SDLActivity.nativeResume();
}
inside the SDLActivity.onDestroy function right before the call to
SDLActivity.nativeQuit();
On 2014-02-20 18:53:41 +0000, Gabriel Jacobo wrote:
SDL already takes care of the case you mention inside Java_org_libsdl_app_SDLActivity_nativeQuit.
I was just testing this with testgles2.c on my Nexus 4 and it seems Android sometimes gives you a few seconds to finish up (in which case SDL completes the exit process cleanly in the test case you mentioned), and sometimes it just kills the app directly (you can see the kill message in the log), and you might not even get the "onDestroy()" message on the log. In either case, I'm pretty certain that there's no deadlock occurring.
So, I'm going to mark this as invalid given that it seems we are doing as best as we can to handle the quit from task manager situation.
If you'd like to suggest an alternative fix or improvement, feel free to reopen.
Thanks for the feedback!
The text was updated successfully, but these errors were encountered:
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.1
Reported for operating system, platform: Android (All), All
Comments on the original bug report:
On 2014-02-02 19:23:45 +0000, Peter Jankuliak wrote:
On 2014-02-20 18:53:41 +0000, Gabriel Jacobo wrote:
The text was updated successfully, but these errors were encountered: