From d76a974625a83c0d035bdd4ccb07e95c59921819 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 27 Jul 2015 17:26:45 -0400 Subject: [PATCH] Added guard based on std::uncaught_exception so the class does not throw in an exception handler --- trdlocal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trdlocal.cpp b/trdlocal.cpp index 6ca9222c..9c83e125 100644 --- a/trdlocal.cpp +++ b/trdlocal.cpp @@ -36,11 +36,11 @@ ThreadLocalStorage::ThreadLocalStorage() ThreadLocalStorage::~ThreadLocalStorage() CRYPTOPP_THROW { #ifdef HAS_WINTHREADS - if (!TlsFree(m_index)) + if (!TlsFree(m_index) && !std::uncaught_exception()) throw Err("TlsFree", GetLastError()); #else int error = pthread_key_delete(m_index); - if (error) + if (error && !std::uncaught_exception()) throw Err("pthread_key_delete", error); #endif }