fixed crash restart conditions

This commit is contained in:
fourtf 2019-09-22 16:14:16 +02:00
parent 431d35e528
commit f27c8eb1b4
2 changed files with 15 additions and 14 deletions

View file

@ -39,6 +39,11 @@ macx {
LIBS += -L/usr/local/lib
}
# Set C_DEBUG if it's a debug build
CONFIG(debug, debug|release) {
DEFINES += C_DEBUG
}
# Submodules
include(lib/warnings.pri)
include(lib/appbase.pri)

View file

@ -114,16 +114,14 @@ namespace {
{
using namespace std::chrono_literals;
// if (std::chrono::steady_clock::now() - signalsInitTime > 30s)
// {
QProcess proc;
proc.setProgram(QApplication::applicationFilePath());
proc.setArguments({"--crash-recovery"});
proc.startDetached();
// QProcess::startDetached(QApplication::applicationFilePath(),
// {"--crash-recovery"});
// }
if (restartOnSignal &&
std::chrono::steady_clock::now() - signalsInitTime > 30s)
{
QProcess proc;
proc.setProgram(QApplication::applicationFilePath());
proc.setArguments({"--crash-recovery"});
proc.startDetached();
}
_exit(signum);
}
@ -132,13 +130,11 @@ namespace {
// true.
void initSignalHandler()
{
//#if not defined(DEBUG) && not defined(_DEBUG) && not defined(NDEBUG)
#ifndef C_DEBUG
signalsInitTime = std::chrono::steady_clock::now();
// signal(SIGINT, handleSignal);
signal(SIGSEGV, handleSignal);
// signal(SIGABRT_COMPAT, handleSignal);
//#endif
#endif
}
} // namespace