Unstable 0.17.9.0

This commit is contained in:
Markus Isberg
2022-04-12 03:39:02 +09:00
parent 374f03c625
commit 72328c29cb
38 changed files with 361 additions and 184 deletions
@@ -167,7 +167,13 @@ namespace Barotrauma
Texture2D newTexture = TextureLoader.FromFile(file, compress);
lock (list)
{
textureRefCounts.Add(fullPath, new TextureRefCounter { RefCount = 1, Texture = newTexture });
if (!textureRefCounts.TryAdd(fullPath,
new TextureRefCounter { RefCount = 1, Texture = newTexture }))
{
CrossThread.RequestExecutionOnMainThread(() => newTexture.Dispose());
textureRefCounts[fullPath].RefCount++;
return textureRefCounts[fullPath].Texture;
}
}
return newTexture;
}