ConfigObject: Initialize local static var at declaration to ensure thread safety

This commit is contained in:
Yonas Habteab 2022-02-25 15:18:28 +01:00
parent fb21345bfd
commit f00a3c9693
1 changed files with 1 additions and 7 deletions

View File

@ -413,13 +413,7 @@ void ConfigObject::OnConfigLoaded()
void ConfigObject::OnAllConfigLoaded()
{
static ConfigType *ctype;
if (!ctype) {
Type::Ptr type = Type::GetByName("Zone");
ctype = dynamic_cast<ConfigType *>(type.get());
}
static ConfigType *ctype = dynamic_cast<ConfigType *>(Type::GetByName("Zone").get());
String zoneName = GetZoneName();
if (!zoneName.IsEmpty())