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

SDL2 apps don't exit correctly if killed externally. #19

Open
fifteenhex opened this issue Feb 21, 2022 · 4 comments
Open

SDL2 apps don't exit correctly if killed externally. #19

fifteenhex opened this issue Feb 21, 2022 · 4 comments

Comments

@fifteenhex
Copy link
Contributor

For SDL2 apps (Tested with scummvm) running with the DirectFB backend if they exit via a trigger in the app itself they shut down cleanly.
However, if the app if killed by ctrl-c etc DirectFB starts tearing down everything but SDL2 doesn't report to the app that DirectFB is going away and the app continues to try updating the surface it's using causing assertions when DirectFB structures are accessed after they have already been disposed of.

It looks like there are two problems:

  • SDL2 doesn't consume the window destroy event from DirectFB so it doesn't pass that on to the app so the app keeps going.
  • Although DirectFB is sending a window destroy event after destroying the window that event doesn't seem to make it to SDL2. It looks like the transport (fusion?) for the event is already down by time the event is queued so it never actually gets sent.
@fifteenhex fifteenhex changed the title SDL2 apps don't exit correct if killed externally. SDL2 apps don't exit correctly if killed externally. Feb 21, 2022
@fifteenhex
Copy link
Contributor Author

Looks like it happens in the examples too. df_fire has a similar issue.
It looks like it's getting stuck waiting surface->Flip() to return after ctrl-c is hit and DirectFB has started tearing everything down.

Seems to happen with drmkms and fbdev.

@caramelli
Copy link
Contributor

You can try no-sighandler option in directfbrc config file.

@fifteenhex
Copy link
Contributor Author

You can try no-sighandler option in directfbrc config file.

Ah, I did see that but forgot about it. I guess that fixes the issue by letting the app handle the signal and do the tear down in the opposite direction. I wonder in what case you would want DirectFB to do it.

Maybe for the master application in a multi-app setup?

@caramelli
Copy link
Contributor

I usually use an event (such as a key event) to trigger the application shutdown.

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

2 participants