mirror of
https://github.com/ppy/osu
synced 2025-02-02 11:21:59 +00:00
Move MusicController
binds to LoadComplete
for added thread safety
This commit is contained in:
parent
1eaaf80b99
commit
4e9b25d8b0
@ -58,12 +58,11 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
// Todo: These binds really shouldn't be here, but are unlikely to cause any issues for now.
|
||||
// They are placed here for now since some tests rely on setting the beatmap _and_ their hierarchies inside their load(), which runs before the MusicController's load().
|
||||
beatmap.BindValueChanged(beatmapChanged, true);
|
||||
base.LoadComplete();
|
||||
|
||||
beatmap.BindValueChanged(b => changeBeatmap(b.NewValue), true);
|
||||
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
||||
}
|
||||
|
||||
@ -263,8 +262,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
private IQueryable<BeatmapSetInfo> getBeatmapSets() => realm.Realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending);
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap) => changeBeatmap(beatmap.NewValue);
|
||||
|
||||
private void changeBeatmap(WorkingBeatmap newWorking)
|
||||
{
|
||||
// This method can potentially be triggered multiple times as it is eagerly fired in next() / prev() to ensure correct execution order
|
||||
|
Loading…
Reference in New Issue
Block a user