SDL icon indicating copy to clipboard operation
SDL copied to clipboard

SDL3 Android can't seem to hit SDL_EVENT_TERMINATING or SDL_EVENT_QUIT with SDL_AppEvent

Open MattGuerrette opened this issue 1 year ago • 2 comments

Using the main callback functions, I can't seem to get an SDL_EVENT_TERMINATING or SDL_EVENT_QUIT to post when I close the app on Android so I never hit SDL_AppQuit() to do final cleanup.

All the examples I can find of the SDL_AppEvent show returning SDL_APP_SUCCESS/SDL_APP_FAILURE from SDL_EVENT_TERMINATING or SDL_EVENT_QUIT....

Is this expected behavior on Android? From a glance at the video/SDL_androidevents.c it should be posting the events.

Im testing on device using the following:

Samsung Galaxy Tab S6 Lite Android 14

MattGuerrette avatar Sep 20 '24 00:09 MattGuerrette

This is working for me. I'm adding code to automatically quit the event loop even if those events aren't handled, but if you return SDL_APP_SUCCESS/SDL_APP_FAILURE from those events, your application should be getting the quit sequence.

Here's what I'm seeing, with an additional log message in SDL_QuitMainCallbacks():

10-17 16:31:29.926 23668 23668 V SDL     : onPause()
10-17 16:31:29.931 23668 23668 V SDL     : surfaceDestroyed()
10-17 16:31:29.931 23668 23668 V SDL     : nativePause()
10-17 16:31:29.937 23668 23711 I SDL/APP : SDL EVENT: Window 2 minimized
10-17 16:31:29.937 23668 23711 I SDL/APP : SDL EVENT: App will enter the background
10-17 16:31:29.938 23668 23711 I SDL/APP : SDL EVENT: App entered the background
10-17 16:31:29.941 23668 23668 V SDL     : onStop()
10-17 16:31:29.953 23668 23668 V SDL     : onDestroy()
10-17 16:31:29.956 23668 23711 I SDL/APP : SDL EVENT: Quit requested
10-17 16:31:29.956 23668 23711 I SDL/APP : SDL_QuitMainCallbacks
10-17 16:31:29.967 23668 23711 V SDL     : Finished main function
10-17 16:31:29.968 23668 23668 V SDL     : SDLActivity thread ends

slouken avatar Oct 17 '24 23:10 slouken

What are you seeing?

slouken avatar Oct 17 '24 23:10 slouken

Thanks for checking. I'll try and take another stab at this when I have time. Closing for now, and I'll re-open if necessary.

MattGuerrette avatar Oct 21 '24 02:10 MattGuerrette