From 36c75218e457d8451010983b36cd4875ea367d00 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())