Added guard based on std::uncaught_exception so the class does not throw in an exception handler

pull/35/head
Jeffrey Walton 2015-07-27 17:26:45 -04:00
parent 836cf237cf
commit d76a974625
1 changed files with 2 additions and 2 deletions

View File

@ -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
}