forked from docsteer/sacnview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrash_test.cpp
53 lines (44 loc) · 1.01 KB
/
crash_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "crash_test.h"
#include "ui_crash_test.h"
#include <QPushButton>
CrashTest::CrashTest(QWidget *parent) :
QDialog(parent),
ui(new Ui::CrashTest)
{
ui->setupUi(this);
m_signalMapper = new QSignalMapper(this);
for (uint n = 0; n < numOfCrashMethods; n++) {
QPushButton *b = new QPushButton(this);
b->setText(QString("Method %1").arg(n));
connect(b, SIGNAL(clicked()), m_signalMapper, SLOT(map()));
m_signalMapper->setMapping(b, n);
ui->verticalLayout->addWidget(b);
}
connect(m_signalMapper, SIGNAL(mapped(int)),
this, SLOT(crashMethod(int)));
}
CrashTest::~CrashTest()
{
delete ui;
}
void CrashTest::crashMethod(const int id)
{
switch (id) {
default:
case 0:
{
abort();
break;
}
case 1:
{
void* jump = nullptr;
((void(*)())jump)();
break;
}
case 2:
{
*((int*) 0) = 0;
}
}
}