Make sure to remove thread local data only if we have destructor.

This commit is contained in:
Vytautas Astrauskas 2020-04-26 20:50:58 -07:00
parent 911ff7eade
commit d9e18ada39

View File

@ -181,8 +181,8 @@ fn fetch_tls_dtor(
{
match data.entry(thread_id) {
Entry::Occupied(entry) => {
let data_scalar = entry.remove();
if let Some(dtor) = dtor {
let data_scalar = entry.remove();
let ret = Some((*dtor, data_scalar, key));
return ret;
}