From 8b1b6050e74d3dc2bc1c333f4be32e43bc643590 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Tue, 10 Sep 2013 08:04:36 -0700 Subject: [PATCH] Put back BEAST_CATCH_UNHANDLED_EXCEPTIONS macro, but disabled by default --- Builds/VisualStudio2012/BeastConfig.h | 10 ++++++++++ modules/beast_core/diagnostic/beast_ProtectedCall.cpp | 6 ++++++ modules/beast_core/system/BeastConfigCheck.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Builds/VisualStudio2012/BeastConfig.h b/Builds/VisualStudio2012/BeastConfig.h index 7f07cf01c8..600c4d35a2 100644 --- a/Builds/VisualStudio2012/BeastConfig.h +++ b/Builds/VisualStudio2012/BeastConfig.h @@ -74,6 +74,16 @@ //#define BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES 1 #endif +/** Config: BEAST_CATCH_UNHANDLED_EXCEPTIONS + This will wrap thread entry points with an exception catching block. + A customizable hook is provided to get called when unhandled exceptions + are thrown. + @see ProtectedCall +*/ +#ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS +//#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 1 +#endif + //------------------------------------------------------------------------------ // // Libraries diff --git a/modules/beast_core/diagnostic/beast_ProtectedCall.cpp b/modules/beast_core/diagnostic/beast_ProtectedCall.cpp index 1e862138dd..6b40d4bbb0 100644 --- a/modules/beast_core/diagnostic/beast_ProtectedCall.cpp +++ b/modules/beast_core/diagnostic/beast_ProtectedCall.cpp @@ -314,6 +314,7 @@ void ProtectedCall::call (Call& c) if (handler == nullptr) handler = &defaultHandler; +#if BEAST_CATCH_UNHANDLED_EXCEPTIONS try { c (); @@ -324,6 +325,11 @@ void ProtectedCall::call (Call& c) handler->onException (e); } + +#else + c (); + +#endif } //------------------------------------------------------------------------------ diff --git a/modules/beast_core/system/BeastConfigCheck.h b/modules/beast_core/system/BeastConfigCheck.h index 3abe5d46c9..2ce310578d 100644 --- a/modules/beast_core/system/BeastConfigCheck.h +++ b/modules/beast_core/system/BeastConfigCheck.h @@ -56,7 +56,7 @@ #endif #ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS -#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 1 +#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 0 #endif #if BEAST_DEBUG && ! defined (BEAST_CHECK_MEMORY_LEAKS)