Reapply "dont call I_Quit from withing quit_handler, let it signal main loop to quit"

This reverts commit 8156c6e210.
This commit is contained in:
NepDisk 2025-12-25 22:14:04 -05:00
parent 8156c6e210
commit e711494a07
4 changed files with 17 additions and 3 deletions

View file

@ -991,6 +991,9 @@ void D_SRB2Loop(void)
for (;;)
{
if (I_Interrupted())
I_Quit();
precise_t enterprecise = I_GetPreciseTime();
memset(&g_dc, 0, sizeof(g_dc));

View file

@ -288,6 +288,8 @@ INT32 I_StartupSystem(void);
*/
void I_ShutdownSystem(void);
boolean I_Interrupted(void);
/** \brief The I_GetDiskFreeSpace function
\param freespace a INT64 pointer to hold the free space amount

View file

@ -525,11 +525,19 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
}
#endif
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
static volatile sig_atomic_t interrupted = 0;
boolean I_Interrupted(void)
{
return interrupted;
}
static void quit_handler(int num)
{
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
//I_Quit();
interrupted = true;
}
#ifdef HAVE_TERMIOS

View file

@ -1839,7 +1839,8 @@ void I_ShutdownGraphics(void)
SDL_GL_DeleteContext(sdlglcontext);
}
#endif
SDL_QuitSubSystem(SDL_INIT_VIDEO);
if (SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO)
SDL_QuitSubSystem(SDL_INIT_VIDEO);
framebuffer = SDL_FALSE;
}