From c7db40783221ab1bbbc28feb2d0898af0ceec528 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 Aug 2018 14:53:16 +0900 Subject: [PATCH] Fix operation cancelled exception when changing visual settings --- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 6 ++---- osu.Game/Skinning/SkinReloadableDrawable.cs | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) 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..3ff28ab871 100644 --- a/osu.Game/Skinning/SkinReloadableDrawable.cs +++ b/osu.Game/Skinning/SkinReloadableDrawable.cs @@ -52,5 +52,12 @@ namespace osu.Game.Skinning protected virtual void SkinChanged(ISkinSource skin, bool allowFallback) { } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + skin.SourceChanged -= onChange; + } } }