mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Partial revert "sdl/i_system.cpp: fix compiler errors"
This reverts commit bca2c8cb19.
The changes to I_ReportSignal introduced implicit calls to malloc.
malloc is not signal-safe.
This commit is contained in:
parent
6c678bf347
commit
2c50b6a41a
1 changed files with 36 additions and 29 deletions
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#include <thread>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
@ -371,16 +369,53 @@ static void I_ShowErrorMessageBox(const char *messagefordevelopers, boolean dump
|
|||
static void I_ReportSignal(int num, int coredumped)
|
||||
{
|
||||
//static char msg[] = "oh no! back to reality!\r\n";
|
||||
auto report = [coredumped](std::string sigmsg)
|
||||
const char * sigmsg;
|
||||
char msg[128];
|
||||
|
||||
switch (num)
|
||||
{
|
||||
// case SIGINT:
|
||||
// sigmsg = "SIGINT - interrupted";
|
||||
// break;
|
||||
case SIGILL:
|
||||
sigmsg = "SIGILL - illegal instruction - invalid function image";
|
||||
break;
|
||||
case SIGFPE:
|
||||
sigmsg = "SIGFPE - mathematical exception";
|
||||
break;
|
||||
case SIGSEGV:
|
||||
sigmsg = "SIGSEGV - segment violation";
|
||||
break;
|
||||
// case SIGTERM:
|
||||
// sigmsg = "SIGTERM - Software termination signal from kill";
|
||||
// break;
|
||||
// case SIGBREAK:
|
||||
// sigmsg = "SIGBREAK - Ctrl-Break sequence";
|
||||
// break;
|
||||
case SIGABRT:
|
||||
sigmsg = "SIGABRT - abnormal termination triggered by abort call";
|
||||
break;
|
||||
default:
|
||||
sprintf(msg,"signal number %d", num);
|
||||
if (coredumped)
|
||||
{
|
||||
sigmsg += " (core dumped)";
|
||||
sigmsg = 0;
|
||||
else
|
||||
sigmsg = msg;
|
||||
}
|
||||
|
||||
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg.c_str());
|
||||
if (coredumped)
|
||||
{
|
||||
if (sigmsg)
|
||||
sprintf(msg, "%s (core dumped)", sigmsg);
|
||||
else
|
||||
strcat(msg, " (core dumped)");
|
||||
|
||||
I_ShowErrorMessageBox(sigmsg.c_str(),
|
||||
sigmsg = msg;
|
||||
}
|
||||
|
||||
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
|
||||
|
||||
I_ShowErrorMessageBox(sigmsg,
|
||||
#if defined (UNIXBACKTRACE)
|
||||
true
|
||||
#elif defined (_WIN32)
|
||||
|
|
@ -389,34 +424,6 @@ static void I_ReportSignal(int num, int coredumped)
|
|||
false
|
||||
#endif
|
||||
);
|
||||
};
|
||||
|
||||
switch (num)
|
||||
{
|
||||
// case SIGINT:
|
||||
// report("SIGINT - interrupted");
|
||||
// break;
|
||||
case SIGILL:
|
||||
report("SIGILL - illegal instruction - invalid function image");
|
||||
break;
|
||||
case SIGFPE:
|
||||
report("SIGFPE - mathematical exception");
|
||||
break;
|
||||
case SIGSEGV:
|
||||
report("SIGSEGV - segment violation");
|
||||
break;
|
||||
// case SIGTERM:
|
||||
// report("SIGTERM - Software termination signal from kill");
|
||||
// break;
|
||||
// case SIGBREAK:
|
||||
// report("SIGBREAK - Ctrl-Break sequence");
|
||||
// break;
|
||||
case SIGABRT:
|
||||
report("SIGABRT - abnormal termination triggered by abort call");
|
||||
break;
|
||||
default:
|
||||
report(fmt::format("signal number {}", num));
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NEWSIGNALHANDLER
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue