mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
Support stacktrace on Windows
adds 'strace_win' CONFIG option
This commit is contained in:
22
src/main.cpp
22
src/main.cpp
@@ -65,6 +65,12 @@ Q_IMPORT_PLUGIN(qico)
|
||||
#include "stacktrace.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(STACKTRACE_WIN)
|
||||
#include <signal.h>
|
||||
#include "stacktrace_win.h"
|
||||
#include "stacktrace_win_dlg.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "misc.h"
|
||||
#include "preferences.h"
|
||||
@@ -127,7 +133,7 @@ public:
|
||||
|
||||
#include "main.moc"
|
||||
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_WIN)
|
||||
void sigintHandler(int) {
|
||||
signal(SIGINT, 0);
|
||||
qDebug("Catching SIGINT, exiting cleanly");
|
||||
@@ -142,19 +148,31 @@ void sigtermHandler(int) {
|
||||
void sigsegvHandler(int) {
|
||||
signal(SIGABRT, 0);
|
||||
signal(SIGSEGV, 0);
|
||||
#ifndef Q_OS_WIN
|
||||
std::cerr << "\n\n*************************************************************\n";
|
||||
std::cerr << "Catching SIGSEGV, please report a bug at http://bug.qbittorrent.org\nand provide the following backtrace:\n";
|
||||
std::cerr << "qBittorrent version: " << VERSION << std::endl;
|
||||
print_stacktrace();
|
||||
#else
|
||||
StraceDlg dlg;
|
||||
dlg.setStacktraceString(straceWin::getBacktrace());
|
||||
dlg.exec();
|
||||
#endif
|
||||
raise(SIGSEGV);
|
||||
}
|
||||
void sigabrtHandler(int) {
|
||||
signal(SIGABRT, 0);
|
||||
signal(SIGSEGV, 0);
|
||||
#ifndef Q_OS_WIN
|
||||
std::cerr << "\n\n*************************************************************\n";
|
||||
std::cerr << "Catching SIGABRT, please report a bug at http://bug.qbittorrent.org\nand provide the following backtrace:\n";
|
||||
std::cerr << "qBittorrent version: " << VERSION << std::endl;
|
||||
print_stacktrace();
|
||||
#else
|
||||
StraceDlg dlg;
|
||||
dlg.setStacktraceString(straceWin::getBacktrace());
|
||||
dlg.exec();
|
||||
#endif
|
||||
raise(SIGABRT);
|
||||
}
|
||||
#endif
|
||||
@@ -309,7 +327,7 @@ int main(int argc, char *argv[]) {
|
||||
#ifndef DISABLE_GUI
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
#endif
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_WIN)
|
||||
signal(SIGABRT, sigabrtHandler);
|
||||
signal(SIGTERM, sigtermHandler);
|
||||
signal(SIGINT, sigintHandler);
|
||||
|
||||
Reference in New Issue
Block a user