Skip to content

Commit b9d7f7e

Browse files
committed
Fix blocking of Windows Error popups and use in unitTest.
1 parent 76e6700 commit b9d7f7e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/CoinError.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ bool COINUTILSLIB_EXPORT CoinError::printErrors_ = false;
88

99
/** A function to block the popup windows that windows creates when the code
1010
crashes */
11-
#ifdef HAVE_WINDOWS_H
11+
#ifdef _MSC_VER
1212
#include <windows.h>
13+
#include <stdlib.h>
1314
COINUTILSLIB_EXPORT
1415
void WindowsErrorPopupBlocker()
1516
{
1617
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
18+
_set_abort_behavior(0, _WRITE_ABORT_MSG);
1719
}
1820
#else
1921
COINUTILSLIB_EXPORT

test/unitTest.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ void testingMessage( const char * const msg );
5252

5353
int main (int argc, const char *argv[])
5454
{
55+
// Stop Windows popup
56+
WindowsErrorPopupBlocker();
57+
5558
/*
5659
Set default location for Data directory, assuming traditional
5760
package layout.

0 commit comments

Comments
 (0)