Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
6b2dc5d6
Commit
6b2dc5d6
authored
May 24, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added --no-windows-assert-ui command line option
This disables Windows C Runtime assert dialogs from popping up.
parent
900c88fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
10 deletions
+39
-10
main.cc
src/main.cc
+39
-10
No files found.
src/main.cc
View file @
6b2dc5d6
...
...
@@ -36,6 +36,10 @@ This file is part of the QGROUNDCONTROL project
#include "TCPLink.h"
#ifdef QT_DEBUG
#include "AutoTest.h"
#include "CmdLineOptParser.h"
#ifdef Q_OS_WIN
#include <crtdbg.h>
#endif
#endif
/* SDL does ugly things to main() */
...
...
@@ -44,10 +48,10 @@ This file is part of the QGROUNDCONTROL project
#endif
// Install a message handler so you do not need
// the MSFT debug tools installed to se
// qDebug(), qWarning(), qCritical and qAbort
#ifdef Q_OS_WIN
/// @brief Message handler which is installed using qInstallMsgHandler so you do not need
/// the MSFT debug tools installed to see qDebug(), qWarning(), qCritical and qAbort
void
msgHandler
(
QtMsgType
type
,
const
char
*
msg
)
{
const
char
symbols
[]
=
{
'I'
,
'E'
,
'!'
,
'X'
};
...
...
@@ -56,6 +60,17 @@ void msgHandler( QtMsgType type, const char* msg )
if
(
type
==
QtFatalMsg
)
abort
();
}
/// @brief CRT Report Hook installed using _CrtSetReportHook. We install this hook when
/// we don't want asserts to pop a dialog on windows.
int
WindowsCrtReportHook
(
int
reportType
,
char
*
message
,
int
*
returnValue
)
{
Q_UNUSED
(
reportType
);
std
::
cerr
<<
message
<<
std
::
endl
;
// Output message to stderr
*
returnValue
=
0
;
// Don't break into debugger
return
true
;
// We handled this fully ourselves
}
#endif
/**
...
...
@@ -81,13 +96,27 @@ int main(int argc, char *argv[])
qRegisterMetaType
<
QAbstractSocket
::
SocketError
>
();
#ifdef QT_DEBUG
if
(
argc
>
1
&&
QString
(
argv
[
1
]).
compare
(
"--unittest"
,
Qt
::
CaseInsensitive
)
==
0
)
{
// Strip off extra command line args so QTest doesn't complain
for
(
int
i
=
1
;
i
<
argc
-
1
;
i
++
)
{
argv
[
i
]
=
argv
[
i
+
1
];
}
// We parse a small set of command line options here prior to QGCCore in order to handle the ones
// which need to be handled before a QApplication object is started.
bool
runUnitTests
=
false
;
// Run unit test
bool
quietWindowsAsserts
=
false
;
// Don't let asserts pop dialog boxes
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
{
"--unittest"
,
&
runUnitTests
},
{
"--no-windows-assert-ui"
,
&
quietWindowsAsserts
},
// Add additional command line option flags here
};
ParseCmdLineOptions
(
argc
,
argv
,
rgCmdLineOptions
,
sizeof
(
rgCmdLineOptions
)
/
sizeof
(
rgCmdLineOptions
[
0
]),
true
);
if
(
quietWindowsAsserts
)
{
#ifdef Q_OS_WIN
_CrtSetReportHook
(
WindowsCrtReportHook
);
#endif
}
if
(
runUnitTests
)
{
// Run the test
int
failures
=
AutoTest
::
run
(
argc
-
1
,
argv
);
if
(
failures
==
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment