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:
parent
31c8586dac
commit
e536f1ad6d
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user