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 | d0bfbb336f5e33028442343d4a3c5ef755801e17 (patch) | |
tree | e1913ed37b4a489066295b3ec1877b155197670b /libcxxabi | |
parent | 3cfb9c672c38e59b82410cd252e99701f1d3244e (diff) | |
download | bcm5719-llvm-d0bfbb336f5e33028442343d4a3c5ef755801e17.tar.gz bcm5719-llvm-d0bfbb336f5e33028442343d4a3c5ef755801e17.zip |
Teach exception_cleanup_func about dependent exceptions.
llvm-svn: 149520
Diffstat (limited to 'libcxxabi')
-rw-r--r-- | libcxxabi/src/cxa_exception.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp index b6b91538458..6f482a2b623 100644 --- a/libcxxabi/src/cxa_exception.cpp +++ b/libcxxabi/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) { |