2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
|
2012-01-10 00:28:42 +00:00
|
|
|
#include <QtCore/QCoreApplication>
|
2020-11-26 16:31:50 +00:00
|
|
|
#include <QTest>
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
2021-11-19 05:05:38 +00:00
|
|
|
#include <qt_windows.h>
|
2011-04-27 10:05:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
class tst_Crashes: public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void crash();
|
|
|
|
};
|
|
|
|
|
|
|
|
void tst_Crashes::crash()
|
|
|
|
{
|
2020-06-05 07:24:37 +00:00
|
|
|
#if defined(Q_OS_WIN)
|
2011-04-27 10:05:43 +00:00
|
|
|
//we avoid the error dialogbox to appear on windows
|
|
|
|
SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
|
|
|
#endif
|
2012-02-08 04:06:18 +00:00
|
|
|
/*
|
|
|
|
We deliberately dereference an invalid but non-zero address;
|
|
|
|
it should be non-zero because a few platforms may have special crash behavior
|
|
|
|
when dereferencing exactly 0 (e.g. some macs have been observed to generate SIGILL
|
|
|
|
rather than SIGSEGV).
|
|
|
|
*/
|
2011-04-27 10:05:43 +00:00
|
|
|
int *i = 0;
|
2012-02-08 04:06:18 +00:00
|
|
|
i[1] = 1;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QTEST_MAIN(tst_Crashes)
|
|
|
|
|
|
|
|
#include "tst_crashes.moc"
|