Signal handling bug

Hi!

I encountered the following bug:
SDL doesn’t reset signal handlers for SIGTERM and SIGINT, after calling SDL_Quit these remain hooked to the handler in SDL_quit.c, being translated into SDL_QUIT events.

Consequently an application that issues a SDL_Quit and remains running will ignore any SIGTERM or SIGINT., and specifically CTRL-C presses.

Actually (at least I think) there is no cleanup code in SDL_quit at all. SDL_fatal will only reset fatal signal handlers, which don’t include SIGINT and SIGTERM.

You might argue that once a process issues SDL_Quit it is going to terminate shortly, but this is not necessarily true, my application is a server that initialises SDL once per session. Between the sessions it should be possible to terminate the server by pressing CTRL-C (sending SIGINT), but this fails for the above reason.

And of course of course SDL_Quit SHOULD reset all signals set by SDL_Init…

Jiri Svoboda

Actually (at least I think) there is no cleanup code in SDL_quit at all. SDL_fatal will only reset fatal signal handlers, which don’t include SIGINT and SIGTERM.

You’re right, this is fixed in CVS. Thanks!

-Sam Lantinga, Software Engineer, Blizzard Entertainment