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

Expose a wrapper around SDL_QuitMainCallbacks to allow early exit when using callbacks #12524

Open
playmer opened this issue Mar 12, 2025 · 0 comments

Comments

@playmer
Copy link
Contributor

playmer commented Mar 12, 2025

Someone ran into the issue of needing to early exit deep into the call stack when using callbacks and asked what the proper way to do so would be.

I suggested something like the following:

SDL_AppQuit(appStateTheUserMightNotHave, SDL_APP_FAILURE);
SDL_Quit();
exit(1);

And after poking around it seems we have SDL_QuitMainCallbacks internally which seems superficially similar to this, albeit without the call to exit. Can we expose something that wraps this and calls exit? I think the only immediate concern is that some platforms (I'm looking at iOS, with it's call to SDL_UpdateLifecycleObserver as an example) might need to do some cleanup, so that might need to be abstracted into a function for this wrapper to call.

Does something like this sound reasonable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant