mirror of
https://github.com/osukey/osukey.git
synced 2025-05-13 01:27:32 +09:00
Merge pull request #5381 from peppy/fix-leaderboard-display-crash
Fix potential crash when displaying leaderbaords
This commit is contained in:
commit
bee30b18d2
@ -51,7 +51,6 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
loading.Hide();
|
loading.Hide();
|
||||||
|
|
||||||
// schedule because we may not be loaded yet (LoadComponentAsync complains).
|
|
||||||
showScoresDelegate?.Cancel();
|
showScoresDelegate?.Cancel();
|
||||||
showScoresCancellationSource?.Cancel();
|
showScoresCancellationSource?.Cancel();
|
||||||
|
|
||||||
@ -61,28 +60,22 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
// ensure placeholder is hidden when displaying scores
|
// ensure placeholder is hidden when displaying scores
|
||||||
PlaceholderState = PlaceholderState.Successful;
|
PlaceholderState = PlaceholderState.Successful;
|
||||||
|
|
||||||
scrollFlow = CreateScoreFlow();
|
var sf = CreateScoreFlow();
|
||||||
scrollFlow.ChildrenEnumerable = scores.Select((s, index) => CreateDrawableScore(s, index + 1));
|
sf.ChildrenEnumerable = scores.Select((s, index) => CreateDrawableScore(s, index + 1));
|
||||||
|
|
||||||
if (!IsLoaded)
|
// schedule because we may not be loaded yet (LoadComponentAsync complains).
|
||||||
showScoresDelegate = Schedule(showScores);
|
showScoresDelegate = Schedule(() => LoadComponentAsync(sf, _ =>
|
||||||
else
|
|
||||||
showScores();
|
|
||||||
|
|
||||||
void showScores() => LoadComponentAsync(scrollFlow, _ =>
|
|
||||||
{
|
{
|
||||||
scrollContainer.Add(scrollFlow);
|
scrollContainer.Add(scrollFlow = sf);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
foreach (var s in scrollFlow.Children)
|
foreach (var s in scrollFlow.Children)
|
||||||
{
|
|
||||||
using (s.BeginDelayedSequence(i++ * 50, true))
|
using (s.BeginDelayedSequence(i++ * 50, true))
|
||||||
s.Show();
|
s.Show();
|
||||||
}
|
|
||||||
|
|
||||||
scrollContainer.ScrollTo(0f, false);
|
scrollContainer.ScrollTo(0f, false);
|
||||||
}, (showScoresCancellationSource = new CancellationTokenSource()).Token);
|
}, (showScoresCancellationSource = new CancellationTokenSource()).Token));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user