Only update the loading screen from the main thread

Fixes the crash experienced by pchote. It's a hack but it's easy
to get rid of and it will have to do for now, until the messy
LoadScreen gets fixed.
This commit is contained in:
Pavlos Touboulidis
2014-05-13 17:56:27 +03:00
parent a845947e0f
commit ca44be7b2e
4 changed files with 22 additions and 25 deletions

View File

@@ -68,12 +68,8 @@ namespace OpenRA.Graphics
readonly Dictionary<string, Lazy<IReadOnlyDictionary<string, Sequence>>> sequenceCache = new Dictionary<string, Lazy<IReadOnlyDictionary<string, Sequence>>>();
public Action OnProgress;
public SequenceCache(ModData modData, TileSet tileSet)
{
OnProgress = () => { if (modData.LoadScreen != null) modData.LoadScreen.Display(); };
this.modData = modData;
spriteLoader = Exts.Lazy(() => new SpriteLoader(tileSet.Extensions, new SheetBuilder(SheetType.Indexed)));
@@ -87,8 +83,6 @@ namespace OpenRA.Graphics
IReadOnlyDictionary<string, Lazy<IReadOnlyDictionary<string, Sequence>>> Load(List<MiniYamlNode> sequenceNodes)
{
OnProgress();
var sequenceFiles = modData.Manifest.Sequences;
var nodes = sequenceFiles
@@ -113,8 +107,6 @@ namespace OpenRA.Graphics
sequenceCache.Add(key, t);
items.Add(node.Key, t);
}
OnProgress();
}
return new ReadOnlyDictionary<string, Lazy<IReadOnlyDictionary<string, Sequence>>>(items);