mirror of
https://github.com/encounter/SDL.git
synced 2025-12-13 07:06:10 +00:00
Added a hint to prevent SDL from installing signal handlers.
Fixes Bugzilla #2431.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
#include "SDL_hints.h"
|
||||
|
||||
/* General quit handling code for SDL */
|
||||
|
||||
@@ -30,6 +31,8 @@
|
||||
#include "SDL_events_c.h"
|
||||
|
||||
|
||||
static SDL_bool disable_signals = SDL_FALSE;
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
static void
|
||||
SDL_HandleSIG(int sig)
|
||||
@@ -46,6 +49,12 @@ SDL_HandleSIG(int sig)
|
||||
int
|
||||
SDL_QuitInit(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_DISABLE_SIGINT_HANDLER);
|
||||
disable_signals = hint && (SDL_atoi(hint) == 1);
|
||||
if (disable_signals) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction action;
|
||||
sigaction(SIGINT, NULL, &action);
|
||||
@@ -80,12 +89,16 @@ SDL_QuitInit(void)
|
||||
#endif /* HAVE_SIGNAL_H */
|
||||
|
||||
/* That's it! */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_QuitQuit(void)
|
||||
{
|
||||
if (disable_signals) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction action;
|
||||
sigaction(SIGINT, NULL, &action);
|
||||
|
||||
Reference in New Issue
Block a user