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:
@@ -22,12 +22,8 @@ namespace OpenRA.Graphics
|
||||
Dictionary<string, CursorSequence> cursors;
|
||||
Cache<string, PaletteReference> palettes;
|
||||
|
||||
public Action OnProgress;
|
||||
|
||||
public CursorProvider(ModData modData)
|
||||
{
|
||||
OnProgress = () => { if (modData.LoadScreen != null) modData.LoadScreen.Display(); };
|
||||
|
||||
var sequenceFiles = modData.Manifest.Cursors;
|
||||
|
||||
cursors = new Dictionary<string, CursorSequence>();
|
||||
@@ -65,8 +61,6 @@ namespace OpenRA.Graphics
|
||||
|
||||
void LoadSequencesForCursor(SpriteLoader loader, string cursorSrc, MiniYaml cursor)
|
||||
{
|
||||
OnProgress();
|
||||
|
||||
foreach (var sequence in cursor.Nodes)
|
||||
cursors.Add(sequence.Key, new CursorSequence(loader, cursorSrc, cursor.Value, sequence.Value));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user