mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Fix potential crash due to children being mutated after disposal
This is a bit of an unfortunate edge case where the unbind-on-disposal doesn't help, since the binding is happening in BDL, and the usage is in a nested `LoadComponentAsync` call. Combine those and you have a recipe for disaster.
This commit is contained in:
parent
69fc7782ec
commit
e7e61cd9ab
@ -330,6 +330,21 @@ namespace osu.Game.Screens.Select
|
|||||||
addInfoLabels();
|
addInfoLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
mods.BindValueChanged(m =>
|
||||||
|
{
|
||||||
|
settingChangeTracker?.Dispose();
|
||||||
|
|
||||||
|
refreshBPMLabel();
|
||||||
|
|
||||||
|
settingChangeTracker = new ModSettingChangeTracker(m.NewValue);
|
||||||
|
settingChangeTracker.SettingChanged += _ => refreshBPMLabel();
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
private void setMetadata(string source)
|
private void setMetadata(string source)
|
||||||
{
|
{
|
||||||
ArtistLabel.Text = artistBinding.Value;
|
ArtistLabel.Text = artistBinding.Value;
|
||||||
@ -360,16 +375,6 @@ namespace osu.Game.Screens.Select
|
|||||||
Children = getRulesetInfoLabels()
|
Children = getRulesetInfoLabels()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mods.BindValueChanged(m =>
|
|
||||||
{
|
|
||||||
settingChangeTracker?.Dispose();
|
|
||||||
|
|
||||||
refreshBPMLabel();
|
|
||||||
|
|
||||||
settingChangeTracker = new ModSettingChangeTracker(m.NewValue);
|
|
||||||
settingChangeTracker.SettingChanged += _ => refreshBPMLabel();
|
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private InfoLabel[] getRulesetInfoLabels()
|
private InfoLabel[] getRulesetInfoLabels()
|
||||||
|
Loading…
Reference in New Issue
Block a user