diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-02-01 18:44:21 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-02-01 18:44:21 +0000 |
commit | 8dd7a48855cc1e11101b967664d9602f49ab6842 (patch) | |
tree | dec5d180bb008aeb93072c5f549e80362382b9ff /src/cxa_exception.cpp | |
parent | 7ab185ea390a9ad39f512bd3e7d3ee6ea76812c8 (diff) |
Teach exception_cleanup_func about dependent exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@149520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/cxa_exception.cpp')
-rw-r--r-- | src/cxa_exception.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp index b6b9153..6f482a2 100644 --- a/src/cxa_exception.cpp +++ b/src/cxa_exception.cpp @@ -128,12 +128,9 @@ exception_cleanup_func(_Unwind_Reason_Code reason, _Unwind_Exception* unwind_exc __cxa_exception* exception_header = cxa_exception_from_exception_unwind_exception(unwind_exception); if (_URC_FOREIGN_EXCEPTION_CAUGHT != reason) std::__terminate(exception_header->terminateHandler); - - // TODO: Shouldn't this check the reference count first? - void * thrown_object = thrown_object_from_cxa_exception(exception_header); - if (NULL != exception_header->exceptionDestructor) - exception_header->exceptionDestructor(thrown_object); - __cxa_free_exception(thrown_object); + // Just in case there exists a dependent exception that is pointing to this, + // check the reference count and only destroy this if that count goes to zero. + __cxa_decrement_exception_refcount(unwind_exception + 1); } static LIBCXXABI_NORETURN void failed_throw(__cxa_exception* exception_header) { |