diff options
Diffstat (limited to 'libstdc++-v3/libsupc++/eh_terminate.cc')
-rw-r--r-- | libstdc++-v3/libsupc++/eh_terminate.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libstdc++-v3/libsupc++/eh_terminate.cc b/libstdc++-v3/libsupc++/eh_terminate.cc index 6acae0593ac..d5f24ea1000 100644 --- a/libstdc++-v3/libsupc++/eh_terminate.cc +++ b/libstdc++-v3/libsupc++/eh_terminate.cc @@ -26,6 +26,7 @@ #include "exception" #include <cstdlib> #include "unwind-cxx.h" +#include "eh_term_handler.h" #include <bits/exception_defines.h> #include <bits/atomic_lockfree_defines.h> @@ -73,6 +74,9 @@ std::unexpected () std::terminate_handler std::set_terminate (std::terminate_handler func) throw() { + if (!func) + func = _GLIBCXX_DEFAULT_TERM_HANDLER; + std::terminate_handler old; #if ATOMIC_POINTER_LOCK_FREE > 1 __atomic_exchange (&__terminate_handler, &func, &old, __ATOMIC_ACQ_REL); @@ -100,6 +104,9 @@ std::get_terminate () noexcept std::unexpected_handler std::set_unexpected (std::unexpected_handler func) throw() { + if (!func) + func = std::terminate; + std::unexpected_handler old; #if ATOMIC_POINTER_LOCK_FREE > 1 __atomic_exchange (&__unexpected_handler, &func, &old, __ATOMIC_ACQ_REL); |