1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 05:22:54 +08:00

Fix potentially incorrect thread access in OsuTabControlCheckbox

https://github.com/ppy/osu/actions/runs/4868337922/jobs/8681736829.
This commit is contained in:
Dean Herbert 2023-05-03 14:33:30 +09:00
parent 6b017ac05f
commit a3efae3690

View File

@ -49,11 +49,10 @@ namespace osu.Game.Graphics.UserInterface
private const float transition_length = 500;
private Sample sampleChecked;
private Sample sampleUnchecked;
private readonly SpriteIcon icon;
public OsuTabControlCheckbox()
{
SpriteIcon icon;
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
@ -85,14 +84,6 @@ namespace osu.Game.Graphics.UserInterface
Anchor = Anchor.BottomLeft,
}
};
Current.ValueChanged += selected =>
{
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
updateFade();
};
}
[BackgroundDependencyLoader]
@ -103,6 +94,14 @@ namespace osu.Game.Graphics.UserInterface
sampleChecked = audio.Samples.Get(@"UI/check-on");
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
Current.ValueChanged += selected =>
{
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
updateFade();
};
}
protected override bool OnHover(HoverEvent e)