Added guard based on std::uncaught_exception so the class does not throw in an exception handler
parent
836cf237cf
commit
d76a974625
|
|
@ -36,11 +36,11 @@ ThreadLocalStorage::ThreadLocalStorage()
|
||||||
ThreadLocalStorage::~ThreadLocalStorage() CRYPTOPP_THROW
|
ThreadLocalStorage::~ThreadLocalStorage() CRYPTOPP_THROW
|
||||||
{
|
{
|
||||||
#ifdef HAS_WINTHREADS
|
#ifdef HAS_WINTHREADS
|
||||||
if (!TlsFree(m_index))
|
if (!TlsFree(m_index) && !std::uncaught_exception())
|
||||||
throw Err("TlsFree", GetLastError());
|
throw Err("TlsFree", GetLastError());
|
||||||
#else
|
#else
|
||||||
int error = pthread_key_delete(m_index);
|
int error = pthread_key_delete(m_index);
|
||||||
if (error)
|
if (error && !std::uncaught_exception())
|
||||||
throw Err("pthread_key_delete", error);
|
throw Err("pthread_key_delete", error);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue