1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +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:
Dean Herbert 2021-12-09 18:50:53 +09:00
parent 69fc7782ec
commit e7e61cd9ab

View File

@ -330,6 +330,21 @@ namespace osu.Game.Screens.Select
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)
{
ArtistLabel.Text = artistBinding.Value;
@ -360,16 +375,6 @@ namespace osu.Game.Screens.Select
Children = getRulesetInfoLabels()
}
};
mods.BindValueChanged(m =>
{
settingChangeTracker?.Dispose();
refreshBPMLabel();
settingChangeTracker = new ModSettingChangeTracker(m.NewValue);
settingChangeTracker.SettingChanged += _ => refreshBPMLabel();
}, true);
}
private InfoLabel[] getRulesetInfoLabels()