Skip to content

Commit 3711471

Browse files
committed
Add option to disable crash-handler at compile time
1 parent 5a4fba6 commit 3711471

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

src/Global.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#if defined(Q_OS_UNIX) && /*defined(QT_NO_DEBUG) &&*/ !defined(NO_CRASH_HANDLER)
2+
#define ENABLE_CRASH_HANDLER
3+
#endif

src/interface/fragment/FirstLaunchWizard.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <QTimer>
1515
#include <QUrl>
1616

17+
#include "Global.h"
18+
1719
#include <utils/DesktopServices.h>
1820

1921
FirstLaunchWizard::FirstLaunchWizard(QWidget *parent) :
@@ -35,7 +37,11 @@ FirstLaunchWizard::FirstLaunchWizard(QWidget *parent) :
3537
ui->stackedWidget->slideInIdx(1);
3638
});
3739
connect(ui->p3_next, &QPushButton::clicked, this, [&] {
40+
#ifdef ENABLE_CRASH_HANDLER
3841
ui->stackedWidget->slideInIdx(2);
42+
#else
43+
ui->stackedWidget->slideInIdx(3);
44+
#endif
3945
});
4046
connect(ui->p3b_next, &QPushButton::clicked, this, [&] {
4147
ui->stackedWidget->slideInIdx(3);

src/interface/fragment/SettingsFragment.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "utils/AutoStartManager.h"
1414
#include "utils/DesktopServices.h"
1515

16+
#include "Global.h"
17+
1618
#include <AeqSelector.h>
1719

1820
#include <AeqPackageManager.h>
@@ -142,6 +144,10 @@ SettingsFragment::SettingsFragment(TrayIcon *trayIcon,
142144
#ifndef QT_NO_SYSTEMTRAYICON
143145
}
144146
#endif
147+
148+
#ifndef ENABLE_CRASH_HANDLER
149+
ui->crashShareGroup->setVisible(false);
150+
#endif
145151
}
146152

147153
SettingsFragment::~SettingsFragment()

src/interface/fragment/SettingsFragment.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@
578578
<widget class="QWidget" name="page">
579579
<layout class="QVBoxLayout" name="verticalLayout_9">
580580
<item>
581-
<widget class="QGroupBox" name="groupBox_2">
581+
<widget class="QGroupBox" name="crashShareGroup">
582582
<property name="title">
583583
<string>Share crash reports</string>
584584
</property>

src/main.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
#include <QTextStream>
1313
#include <QSessionManager>
1414

15-
#define FORCE_CRASH_HANDLER
16-
17-
#if defined(Q_OS_UNIX) && defined(QT_NO_DEBUG) || defined(FORCE_CRASH_HANDLER)
18-
#define ENABLE_CRASH_HANDLER
19-
#endif
15+
#include "Global.h"
2016

2117
#ifdef ENABLE_CRASH_HANDLER
2218
#include "crash/airbag.h"
@@ -137,6 +133,7 @@ int main(int argc,
137133
return 0;
138134
}
139135

136+
#ifdef ENABLE_CRASH_HANDLER
140137
if(lastSessionCrashed)
141138
{
142139
Log::information("Last session crashed unexpectedly. A crash report has been saved here: " + QString(STACKTRACE_LOG_OLD));
@@ -147,6 +144,7 @@ int main(int argc,
147144
CrashReportSender::upload(Log::pathOld(), QString(STACKTRACE_LOG_OLD)); /* fire and forget */
148145
}
149146
}
147+
#endif
150148

151149
// Prepare DspConfig based on cmdline argument
152150
DspConfig::instance(parser.isSet(watch));

src/src.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ FORMS += \
104104
MainWindow.ui
105105

106106
HEADERS += \
107+
Global.h \
107108
config/AppConfig.h \
108109
config/ConfigContainer.h \
109110
config/ConfigIO.h \

0 commit comments

Comments
 (0)