From e6e5f5c559694d179a6e6db76832c5454448437c Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 21 Sep 2015 17:18:55 +0200 Subject: Partially revert "Core/Build: Added missing abort() calls on error handlers" This reverts commit 8ea17647e6bced9d4d027c94ecdc63369cb4c6df. --- src/common/Debugging/Errors.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/common/Debugging/Errors.cpp') diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index 951dd3d8e8c..6c295a993f5 100644 --- a/src/common/Debugging/Errors.cpp +++ b/src/common/Debugging/Errors.cpp @@ -23,13 +23,25 @@ #include #include +/** + @file Errors.cpp + + @brief This file contains definitions of functions used for reporting critical application errors + + It is very important that (std::)abort is NEVER called in place of *((volatile int*)NULL) = 0; + Calling abort() on Windows does not invoke unhandled exception filters - a mechanism used by WheatyExceptionReport + to log crashes. exit(1) calls here are for static analysis tools to indicate that calling functions defined in this file + terminates the application. + */ + namespace Trinity { void Assert(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message); - abort(); + *((volatile int*)NULL) = 0; + exit(1); } void Assert(char const* file, int line, char const* function, char const* message, char const* format, ...) @@ -43,7 +55,8 @@ void Assert(char const* file, int line, char const* function, char const* messag fflush(stderr); va_end(args); - abort(); + *((volatile int*)NULL) = 0; + exit(1); } void Fatal(char const* file, int line, char const* function, char const* message) @@ -52,14 +65,16 @@ void Fatal(char const* file, int line, char const* function, char const* message file, line, function, message); std::this_thread::sleep_for(std::chrono::seconds(10)); - abort(); + *((volatile int*)NULL) = 0; + exit(1); } void Error(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n", file, line, function, message); - abort(); + *((volatile int*)NULL) = 0; + exit(1); } void Warning(char const* file, int line, char const* function, char const* message) @@ -72,7 +87,8 @@ void Abort(char const* file, int line, char const* function) { fprintf(stderr, "\n%s:%i in %s ABORTED.\n", file, line, function); - abort(); + *((volatile int*)NULL) = 0; + exit(1); } } // namespace Trinity -- cgit v1.2.3