diff --git a/Dalamud/Game/Config/GameConfigSection.cs b/Dalamud/Game/Config/GameConfigSection.cs index 7b2751901..a3542ba3e 100644 --- a/Dalamud/Game/Config/GameConfigSection.cs +++ b/Dalamud/Game/Config/GameConfigSection.cs @@ -1,5 +1,5 @@ using System; -using System.Collections.Generic; +using System.Collections.Concurrent; using System.Diagnostics; using Dalamud.Memory; @@ -15,9 +15,8 @@ namespace Dalamud.Game.Config; public class GameConfigSection { private readonly Framework framework; - private readonly Dictionary indexMap = new(); - private readonly Dictionary nameMap = new(); - private readonly Dictionary enumMap = new(); + private readonly ConcurrentDictionary indexMap = new(); + private readonly ConcurrentDictionary enumMap = new(); /// /// Event which is fired when a game config option is changed within the section. @@ -404,12 +403,12 @@ public class GameConfigSection var name = MemoryHelper.ReadStringNullTerminated(new IntPtr(entry->Name)); if (Enum.TryParse(typeof(TEnum), name, out enumObject)) { - this.enumMap.Add(entry->Index, enumObject); + this.enumMap.TryAdd(entry->Index, enumObject); } else { enumObject = null; - this.enumMap.Add(entry->Index, null); + this.enumMap.TryAdd(entry->Index, null); } } @@ -439,7 +438,6 @@ public class GameConfigSection if (eName.Equals(name)) { this.indexMap.TryAdd(name, i); - this.nameMap.TryAdd(i, name); index = i; return true; }