rethrow unwind exception

On Linux with pthread library spdlog causes an SIGABORT and crashes
the application in case it catches a thread specific cancellation
exception in a critical execution phase while in a try/catch block
in spdlog/detail/logger_impl.h

The exception is caught by some general catch(...) clause where
it is NOT rethrown.

However rethrowing these kind of exception is mandatory, otherwise
an abort will be caused by the glibc.
This commit is contained in:
manuel-schiller
2017-10-11 16:21:17 +02:00
committed by Manuel Schiller
parent 9688689938
commit 039b34e83a
2 changed files with 11 additions and 4 deletions

View File

@@ -42,6 +42,12 @@
#define SPDLOG_DEPRECATED
#endif
#ifdef __linux__
#include <cxxabi.h>
#define SPDLOG_CATCH_ALL catch (abi::__forced_unwind&) { _err_handler("Unknown exception"); throw; } catch (...)
#else // __linux__
#define SPDLOG_CATCH_ALL catch (...)
#endif // __linux__
#include "spdlog/fmt/fmt.h"