Move function-scope static QThreadStorage objects to namespace scope

to ensure destruction after all function-scope statics and avoid warning
"thread exited after QThreadStorage destroyed".
This commit is contained in:
Mat Sutcliffe
2019-01-05 16:49:20 +00:00
parent 1493106970
commit e7582f2f3c
4 changed files with 9 additions and 4 deletions

View File

@@ -114,7 +114,7 @@ namespace BlackMisc
static const CLogCategoryList &fromClass()
{
static_assert(sizeof(T) > 0, "T must be a complete type, not forward declared");
static QThreadStorage<CLogCategoryList> list;
static QThreadStorage<CLogCategoryList> list; //! \todo C++17: make list an inline static member variable template
if (! list.hasLocalData())
{
list.localData().appendCategoriesFromMemberFunction(tag<T>(), THasGetLogCategories<T>());