1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:43:22 +08:00

Merge pull request #10380 from peppy/fix-cross-thread-disclaimer

Fix disclaimer potentially running same code from two different threads
This commit is contained in:
Dan Balasescu 2020-10-06 13:23:10 +09:00 committed by GitHub
commit cfdff2389d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,8 +42,11 @@ namespace osu.Game.Screens.Menu
ValidForResume = false;
}
[Resolved]
private IAPIProvider api { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours, IAPIProvider api)
private void load(OsuColour colours)
{
InternalChildren = new Drawable[]
{
@ -104,7 +107,9 @@ namespace osu.Game.Screens.Menu
iconColour = colours.Yellow;
currentUser.BindTo(api.LocalUser);
// manually transfer the user once, but only do the final bind in LoadComplete to avoid thread woes (API scheduler could run while this screen is still loading).
// the manual transfer is here to ensure all text content is loaded ahead of time as this is very early in the game load process and we want to avoid stutters.
currentUser.Value = api.LocalUser.Value;
currentUser.BindValueChanged(e =>
{
supportFlow.Children.ForEach(d => d.FadeOut().Expire());
@ -141,6 +146,8 @@ namespace osu.Game.Screens.Menu
base.LoadComplete();
if (nextScreen != null)
LoadComponentAsync(nextScreen);
currentUser.BindTo(api.LocalUser);
}
public override void OnEntering(IScreen last)