1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Merge pull request #11811 from peppy/fix-mod-display-thread-safety

Fix ModDisplay potentially being operated on before loaded completely
This commit is contained in:
Dan Balasescu 2021-02-18 00:05:31 +09:00 committed by GitHub
commit e30fb72ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,19 +72,6 @@ namespace osu.Game.Screens.Play.HUD
}
},
};
Current.ValueChanged += mods =>
{
iconsContainer.Clear();
foreach (Mod mod in mods.NewValue)
{
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
}
if (IsLoaded)
appearTransform();
};
}
protected override void Dispose(bool isDisposing)
@ -97,7 +84,19 @@ namespace osu.Game.Screens.Play.HUD
{
base.LoadComplete();
appearTransform();
Current.BindValueChanged(mods =>
{
iconsContainer.Clear();
if (mods.NewValue != null)
{
foreach (Mod mod in mods.NewValue)
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
appearTransform();
}
}, true);
iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
}