Skip to content

Commit 80f82ac

Browse files
committed
quit: don't call signal() if we're using sigaction()
At best, this is a no-op. At worst, it might: - Clobber a signal handler someone registered after us - Overwrite the signal mask or flags - Cause unregistration to fail (sigaction() isn't guaranteed to return the exact pointer passed to signal()) (cherry picked from commit 6d99204)
1 parent 78146bb commit 80f82ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/events/SDL_quit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ static bool send_foregrounding_pending = false;
4646

4747
static void SDL_HandleSIG(int sig)
4848
{
49-
// Reset the signal handler
49+
#ifndef HAVE_SIGACTION
50+
// Reset the signal handler if it was installed with signal()
5051
(void)signal(sig, SDL_HandleSIG);
52+
#endif
5153

5254
// Send a quit event next time the event loop pumps.
5355
// We can't send it in signal handler; SDL_malloc() might be interrupted!

0 commit comments

Comments
 (0)