|
|
@ -57,17 +57,15 @@ Q_IMPORT_PLUGIN(QICOPlugin) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif // DISABLE_GUI
|
|
|
|
#endif // DISABLE_GUI
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_UNIX |
|
|
|
|
|
|
|
#include <signal.h> |
|
|
|
#include <signal.h> |
|
|
|
#include <execinfo.h> |
|
|
|
#ifdef STACKTRACE |
|
|
|
|
|
|
|
#ifdef Q_OS_UNIX |
|
|
|
#include "stacktrace.h" |
|
|
|
#include "stacktrace.h" |
|
|
|
#endif // Q_OS_UNIX
|
|
|
|
#else |
|
|
|
|
|
|
|
|
|
|
|
#ifdef STACKTRACE_WIN |
|
|
|
|
|
|
|
#include <signal.h> |
|
|
|
|
|
|
|
#include "stacktrace_win.h" |
|
|
|
#include "stacktrace_win.h" |
|
|
|
#include "stacktrace_win_dlg.h" |
|
|
|
#include "stacktrace_win_dlg.h" |
|
|
|
#endif //STACKTRACE_WIN
|
|
|
|
#endif // Q_OS_UNIX
|
|
|
|
|
|
|
|
#endif //STACKTRACE
|
|
|
|
|
|
|
|
|
|
|
|
#include "application.h" |
|
|
|
#include "application.h" |
|
|
|
#include "base/profile.h" |
|
|
|
#include "base/profile.h" |
|
|
@ -77,9 +75,10 @@ Q_IMPORT_PLUGIN(QICOPlugin) |
|
|
|
#include "upgrade.h" |
|
|
|
#include "upgrade.h" |
|
|
|
|
|
|
|
|
|
|
|
// Signal handlers
|
|
|
|
// Signal handlers
|
|
|
|
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN) |
|
|
|
|
|
|
|
void sigNormalHandler(int signum); |
|
|
|
void sigNormalHandler(int signum); |
|
|
|
|
|
|
|
#ifdef STACKTRACE |
|
|
|
void sigAbnormalHandler(int signum); |
|
|
|
void sigAbnormalHandler(int signum); |
|
|
|
|
|
|
|
#endif |
|
|
|
// sys_signame[] is only defined in BSD
|
|
|
|
// sys_signame[] is only defined in BSD
|
|
|
|
const char *sysSigName[] = { |
|
|
|
const char *sysSigName[] = { |
|
|
|
#if defined(Q_OS_WIN) |
|
|
|
#if defined(Q_OS_WIN) |
|
|
@ -94,7 +93,6 @@ const char *sysSigName[] = { |
|
|
|
"SIGPWR", "SIGUNUSED" |
|
|
|
"SIGPWR", "SIGUNUSED" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
}; |
|
|
|
}; |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU |
|
|
|
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU |
|
|
|
void reportToUser(const char* str); |
|
|
|
void reportToUser(const char* str); |
|
|
@ -255,9 +253,9 @@ int main(int argc, char *argv[]) |
|
|
|
showSplashScreen(); |
|
|
|
showSplashScreen(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN) |
|
|
|
|
|
|
|
signal(SIGINT, sigNormalHandler); |
|
|
|
signal(SIGINT, sigNormalHandler); |
|
|
|
signal(SIGTERM, sigNormalHandler); |
|
|
|
signal(SIGTERM, sigNormalHandler); |
|
|
|
|
|
|
|
#ifdef STACKTRACE |
|
|
|
signal(SIGABRT, sigAbnormalHandler); |
|
|
|
signal(SIGABRT, sigAbnormalHandler); |
|
|
|
signal(SIGSEGV, sigAbnormalHandler); |
|
|
|
signal(SIGSEGV, sigAbnormalHandler); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -281,7 +279,6 @@ void reportToUser(const char* str) |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN) |
|
|
|
|
|
|
|
void sigNormalHandler(int signum) |
|
|
|
void sigNormalHandler(int signum) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU |
|
|
|
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU |
|
|
@ -295,6 +292,7 @@ void sigNormalHandler(int signum) |
|
|
|
qApp->exit(); // unsafe, but exit anyway
|
|
|
|
qApp->exit(); // unsafe, but exit anyway
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STACKTRACE |
|
|
|
void sigAbnormalHandler(int signum) |
|
|
|
void sigAbnormalHandler(int signum) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char *sigName = sysSigName[signum]; |
|
|
|
const char *sigName = sysSigName[signum]; |
|
|
@ -307,16 +305,18 @@ void sigAbnormalHandler(int signum) |
|
|
|
reportToUser(sigName); |
|
|
|
reportToUser(sigName); |
|
|
|
reportToUser("\n"); |
|
|
|
reportToUser("\n"); |
|
|
|
print_stacktrace(); // unsafe
|
|
|
|
print_stacktrace(); // unsafe
|
|
|
|
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
|
|
|
#endif |
|
|
|
#ifdef STACKTRACE_WIN |
|
|
|
|
|
|
|
|
|
|
|
#if defined Q_OS_WIN |
|
|
|
StraceDlg dlg; // unsafe
|
|
|
|
StraceDlg dlg; // unsafe
|
|
|
|
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace()); |
|
|
|
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace()); |
|
|
|
dlg.exec(); |
|
|
|
dlg.exec(); |
|
|
|
#endif // STACKTRACE_WIN
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
signal(signum, SIG_DFL); |
|
|
|
signal(signum, SIG_DFL); |
|
|
|
raise(signum); |
|
|
|
raise(signum); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
|
|
|
#endif // STACKTRACE
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(DISABLE_GUI) |
|
|
|
#if !defined(DISABLE_GUI) |
|
|
|
void showSplashScreen() |
|
|
|
void showSplashScreen() |
|
|
|