1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:52:55 +08:00

Merge pull request #3255 from peppy/catch-cancelled

Catch OperationCanceledException in single file load sequence
This commit is contained in:
Dan Balasescu 2018-08-21 10:32:08 +09:00 committed by GitHub
commit a8b20b8b98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -504,7 +504,25 @@ namespace osu.Game
// schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached).
// with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile,
// we could avoid the need for scheduling altogether.
Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(t => LoadComponentAsync(d, add).Wait()) ?? LoadComponentAsync(d, add); });
Schedule(() =>
{
if (asyncLoadStream != null)
{
//chain with existing load stream
asyncLoadStream = asyncLoadStream.ContinueWith(async t =>
{
try
{
await LoadComponentAsync(d, add);
}
catch (OperationCanceledException)
{
}
});
}
else
asyncLoadStream = LoadComponentAsync(d, add);
});
}
public bool OnPressed(GlobalAction action)