Use more locking to improve thread-safety in Sheet.

This commit is contained in:
RoosterDragon
2014-11-22 17:56:19 +00:00
parent c2b7d9ca5b
commit c2d86557f1

View File

@@ -72,6 +72,8 @@ namespace OpenRA.Graphics
} }
void GenerateTexture() void GenerateTexture()
{
lock (textureLock)
{ {
if (texture == null) if (texture == null)
{ {
@@ -81,8 +83,7 @@ namespace OpenRA.Graphics
if (data != null) if (data != null)
{ {
lock (textureLock)
{
if (dirty) if (dirty)
{ {
texture.SetData(data, Size.Width, Size.Height); texture.SetData(data, Size.Width, Size.Height);
@@ -139,6 +140,8 @@ namespace OpenRA.Graphics
} }
public void CreateBuffer() public void CreateBuffer()
{
lock (textureLock)
{ {
if (data != null) if (data != null)
return; return;
@@ -148,6 +151,7 @@ namespace OpenRA.Graphics
data = texture.GetData(); data = texture.GetData();
releaseBufferOnCommit = false; releaseBufferOnCommit = false;
} }
}
public void CommitData() public void CommitData()
{ {