mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Display error window on crash
This commit is contained in:
parent
4c55b5db20
commit
b82f64dea5
1 changed files with 17 additions and 12 deletions
|
@ -301,37 +301,38 @@ SDL_bool framebuffer = SDL_FALSE;
|
||||||
|
|
||||||
UINT8 keyboard_started = false;
|
UINT8 keyboard_started = false;
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void signal_handler(INT32 num)
|
static void signal_handler(INT32 num)
|
||||||
{
|
{
|
||||||
//static char msg[] = "oh no! back to reality!\r\n";
|
//static char msg[] = "oh no! back to reality!\r\n";
|
||||||
char * sigmsg;
|
char * sigmsg;
|
||||||
char sigdef[32];
|
char sigdef[32];
|
||||||
|
|
||||||
|
D_QuitNetGame(); // Fix server freezes
|
||||||
|
|
||||||
switch (num)
|
switch (num)
|
||||||
{
|
{
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
sigmsg = "interrupt";
|
sigmsg = "SIGINT - interrupted";
|
||||||
break;
|
break;
|
||||||
case SIGILL:
|
case SIGILL:
|
||||||
sigmsg = "illegal instruction - invalid function image";
|
sigmsg = "SIGILL - illegal instruction - invalid function image";
|
||||||
break;
|
break;
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
sigmsg = "floating point exception";
|
sigmsg = "SIGFPE - floating point exception";
|
||||||
break;
|
break;
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
sigmsg = "segment violation";
|
sigmsg = "SIGSEGV - segment violation";
|
||||||
break;
|
break;
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
sigmsg = "Software termination signal from kill";
|
sigmsg = "SIGTERM - Software termination signal from kill";
|
||||||
break;
|
break;
|
||||||
#if !(defined (__unix_) || defined (UNIXCOMMON))
|
#if !(defined (__unix_) || defined (UNIXCOMMON))
|
||||||
case SIGBREAK:
|
case SIGBREAK:
|
||||||
sigmsg = "Ctrl-Break sequence";
|
sigmsg = "SIGBREAK - Ctrl-Break sequence";
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case SIGABRT:
|
case SIGABRT:
|
||||||
sigmsg = "abnormal termination triggered by abort call";
|
sigmsg = "SIGABRT - abnormal termination triggered by abort call";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(sigdef,"signal number %d", num);
|
sprintf(sigdef,"signal number %d", num);
|
||||||
|
@ -339,11 +340,15 @@ static void signal_handler(INT32 num)
|
||||||
}
|
}
|
||||||
|
|
||||||
I_OutputMsg("signal_handler() error: %s\n", sigmsg);
|
I_OutputMsg("signal_handler() error: %s\n", sigmsg);
|
||||||
|
|
||||||
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
|
"Signal caught",
|
||||||
|
sigmsg, NULL);
|
||||||
|
I_ShutdownSystem();
|
||||||
signal(num, SIG_DFL); //default signal action
|
signal(num, SIG_DFL); //default signal action
|
||||||
raise(num);
|
raise(num);
|
||||||
I_Quit();
|
I_Quit();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (NDEBUG) && !defined (DC) && !defined (_WIN32_WCE)
|
#if defined (NDEBUG) && !defined (DC) && !defined (_WIN32_WCE)
|
||||||
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
|
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
|
||||||
|
@ -739,19 +744,19 @@ void I_StartupKeyboard (void)
|
||||||
{
|
{
|
||||||
#if defined (NDEBUG) && !defined (DC)
|
#if defined (NDEBUG) && !defined (DC)
|
||||||
#ifdef SIGILL
|
#ifdef SIGILL
|
||||||
// signal(SIGILL , signal_handler);
|
signal(SIGILL , signal_handler);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGINT
|
#ifdef SIGINT
|
||||||
signal(SIGINT , quit_handler);
|
signal(SIGINT , quit_handler);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGSEGV
|
#ifdef SIGSEGV
|
||||||
// signal(SIGSEGV , signal_handler);
|
signal(SIGSEGV , signal_handler);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGBREAK
|
#ifdef SIGBREAK
|
||||||
signal(SIGBREAK , quit_handler);
|
signal(SIGBREAK , quit_handler);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGABRT
|
#ifdef SIGABRT
|
||||||
// signal(SIGABRT , signal_handler);
|
signal(SIGABRT , signal_handler);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGTERM
|
#ifdef SIGTERM
|
||||||
signal(SIGTERM , quit_handler);
|
signal(SIGTERM , quit_handler);
|
||||||
|
|
Loading…
Reference in a new issue