1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 22:33:05 +08:00

Add simple locking of resourceManagers dictionary for thread safety

This commit is contained in:
Dean Herbert 2021-04-21 14:39:36 +09:00
parent 31c8586dac
commit e536f1ad6d

View File

@ -31,6 +31,8 @@ namespace osu.Game.Localisation
string ns = split[0]; string ns = split[0];
string key = split[1]; string key = split[1];
lock (resourceManagers)
{
if (!resourceManagers.TryGetValue(ns, out var manager)) if (!resourceManagers.TryGetValue(ns, out var manager))
resourceManagers[ns] = manager = new ResourceManager(ns, GetType().Assembly); resourceManagers[ns] = manager = new ResourceManager(ns, GetType().Assembly);
@ -45,6 +47,7 @@ namespace osu.Game.Localisation
return null; return null;
} }
} }
}
public Task<string> GetAsync(string lookup) public Task<string> GetAsync(string lookup)
{ {