diff --git a/osu.Game/Beatmaps/Formats/Decoder.cs b/osu.Game/Beatmaps/Formats/Decoder.cs index 2927654f62..6f45718390 100644 --- a/osu.Game/Beatmaps/Formats/Decoder.cs +++ b/osu.Game/Beatmaps/Formats/Decoder.cs @@ -55,11 +55,11 @@ namespace osu.Game.Beatmaps.Formats } while (line != null && line.Length == 0); if (line == null) - throw new IOException(@"Unknown file format"); + throw new IOException(@"Unknown file format (null)"); - var decoder = typedDecoders.Select(d => line.StartsWith(d.Key) ? d.Value : null).FirstOrDefault(); + var decoder = typedDecoders.Select(d => line.StartsWith(d.Key, StringComparison.InvariantCulture) ? d.Value : null).FirstOrDefault(); if (decoder == null) - throw new IOException(@"Unknown file format"); + throw new IOException($@"Unknown file format ({line})"); return (Decoder)decoder.Invoke(line); } diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 3adf287cf7..25d9442e6f 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -85,12 +85,10 @@ namespace osu.Game.Skinning private void load(OsuConfigManager config) { beatmapSkins = config.GetBindable(OsuSetting.BeatmapSkins); - beatmapSkins.ValueChanged += val => onSourceChanged(); - beatmapSkins.TriggerChange(); + beatmapSkins.BindValueChanged(_ => onSourceChanged()); beatmapHitsounds = config.GetBindable(OsuSetting.BeatmapHitsounds); - beatmapHitsounds.ValueChanged += val => onSourceChanged(); - beatmapHitsounds.TriggerChange(); + beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true); } protected override void LoadComplete() diff --git a/osu.Game/Skinning/SkinReloadableDrawable.cs b/osu.Game/Skinning/SkinReloadableDrawable.cs index f1ee0db6ce..0b94697405 100644 --- a/osu.Game/Skinning/SkinReloadableDrawable.cs +++ b/osu.Game/Skinning/SkinReloadableDrawable.cs @@ -52,5 +52,13 @@ namespace osu.Game.Skinning protected virtual void SkinChanged(ISkinSource skin, bool allowFallback) { } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (skin != null) + skin.SourceChanged -= onChange; + } } }