From f7f4d1333b24b9e2cc5007bd568f472ec7e162a8 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 15 Nov 2009 10:42:03 +0000 Subject: [PATCH] - Catching SIGABRT signal to attempt to display the backtrace when an assertion is hit --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 72e17db15..ee74b6dd8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,6 +72,13 @@ void sigsegvHandler(int) { std::raise(SIGINT); std::abort(); } +void sigabrtHandler(int) { + std::cerr << "\n\n*************************************************************\n"; + std::cerr << "Catching SIGABRT, please report a bug at http://bug.qbittorrent.org\nand provide the following backtrace:\n"; + print_stacktrace(); + std::raise(SIGINT); + std::abort(); +} #endif void useStyle(QApplication *app, int style){ @@ -189,6 +196,7 @@ int main(int argc, char *argv[]){ app->setApplicationName(QString::fromUtf8("qBittorrent")); app->setQuitOnLastWindowClosed(false); #ifndef Q_WS_WIN + signal(SIGABRT, sigabrtHandler); signal(SIGTERM, sigtermHandler); signal(SIGSEGV, sigsegvHandler); #endif