mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Fix incorrect background being loaded due to async race
If the API login (and thus user set) completed between `load` and `LoadComplete`, the re-fetch on user change would not yet be hooked up, causing an incorrect default background to be used instead. Of note, moving this out of async load doesn't really affect load performance as the bulk of the load operation is already scheduled and `LoadComponentAsync`ed anyway
This commit is contained in:
parent
93be4b314b
commit
ff108416d8
@ -56,10 +56,6 @@ namespace osu.Game.Screens.Backgrounds
|
||||
introSequence = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence);
|
||||
|
||||
AddInternal(seasonalBackgroundLoader);
|
||||
|
||||
// Load first background asynchronously as part of BDL load.
|
||||
currentDisplay = RNG.Next(0, background_count);
|
||||
Next();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -73,6 +69,9 @@ namespace osu.Game.Screens.Backgrounds
|
||||
introSequence.ValueChanged += _ => Scheduler.AddOnce(next);
|
||||
seasonalBackgroundLoader.SeasonalBackgroundChanged += () => Scheduler.AddOnce(next);
|
||||
|
||||
currentDisplay = RNG.Next(0, background_count);
|
||||
Next();
|
||||
|
||||
// helper function required for AddOnce usage.
|
||||
void next() => Next();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user