diff --git a/util/thread_status_impl.cc b/util/thread_status_impl.cc index d07a60463..5775aacd7 100644 --- a/util/thread_status_impl.cc +++ b/util/thread_status_impl.cc @@ -21,13 +21,7 @@ std::unordered_map> ThreadStatusImpl::db_key_map_; ThreadStatusImpl::~ThreadStatusImpl() { - std::lock_guard lck(thread_list_mutex_); - for (auto* thread_data : thread_data_set_) { - assert(thread_data->thread_type == ThreadStatus::ThreadType::USER_THREAD); - delete thread_data; - } assert(thread_data_set_.size() == 0); - thread_data_set_.clear(); } void ThreadStatusImpl::UnregisterThread() { @@ -35,6 +29,7 @@ void ThreadStatusImpl::UnregisterThread() { std::lock_guard lck(thread_list_mutex_); thread_data_set_.erase(thread_status_data_); delete thread_status_data_; + thread_status_data_ = nullptr; } }