fix: trigger crash on signal handler

This commit is contained in:
QwQ 2020-08-05 14:54:14 +08:00
parent 11f454bc76
commit 160d58c4b2
No known key found for this signature in database
GPG Key ID: E7FAEFAFCD031D4B
2 changed files with 3 additions and 3 deletions

View File

@ -1 +1 @@
5860 5861

View File

@ -113,7 +113,7 @@ void signalHandler(int signum)
{ {
std::cout << msg.toStdString() << std::endl; std::cout << msg.toStdString() << std::endl;
QDir().mkpath(QV2RAY_CONFIG_DIR + "bugreport/"); QDir().mkpath(QV2RAY_CONFIG_DIR + "bugreport/");
StringToFile(msg, filePath); StringToFile("Signal: " + QSTRN(signum) + NEWLINE + msg, filePath);
std::cout << "Backtrace saved in: " + filePath.toStdString() << std::endl; std::cout << "Backtrace saved in: " + filePath.toStdString() << std::endl;
} }
if (qvApp) if (qvApp)
@ -124,7 +124,7 @@ void signalHandler(int signum)
filePath; filePath;
QvMessageBoxWarn(nullptr, "UNCAUGHT EXCEPTION", message); QvMessageBoxWarn(nullptr, "UNCAUGHT EXCEPTION", message);
} }
exit(-99); kill(0, SIGTRAP);
} }
QPair<Qv2rayExitCode, std::optional<QString>> RunQv2rayApplicationScoped(int argc, char *argv[]) QPair<Qv2rayExitCode, std::optional<QString>> RunQv2rayApplicationScoped(int argc, char *argv[])