From f00a3c96931cfeb70e48fc7427e8a07c2e090224 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 25 Feb 2022 15:18:28 +0100 Subject: [PATCH] ConfigObject: Initialize local static var at declaration to ensure thread safety --- lib/base/configobject.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 81ea917b6..d4592b4ef 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -413,13 +413,7 @@ void ConfigObject::OnConfigLoaded() void ConfigObject::OnAllConfigLoaded() { - static ConfigType *ctype; - - if (!ctype) { - Type::Ptr type = Type::GetByName("Zone"); - ctype = dynamic_cast(type.get()); - } - + static ConfigType *ctype = dynamic_cast(Type::GetByName("Zone").get()); String zoneName = GetZoneName(); if (!zoneName.IsEmpty())