-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix shutdown crash when with
ThreadSpecificPtr
- Loading branch information
Showing
2 changed files
with
36 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
#include "./ThreadSpecificPtr.h" | ||
#include "Errors.h" | ||
|
||
thread_local std::map<void* /* class instance */, void* /* thread specific object */> MaNGOS::thread_specific_ptr_data; | ||
thread_local MaNGOS::ThreadSpecificHolder MaNGOS::gtl_ThreadSpecificPtrHolder; | ||
|
||
MaNGOS::ThreadSpecificHolder::~ThreadSpecificHolder() noexcept | ||
{ | ||
for (auto it : thread_specific_ptr_data) | ||
{ | ||
// Every reference must be deleted before the holder is deallocated, otherwise memory will leak | ||
MANGOS_ASSERT(it.second == nullptr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters