From 7c1b0b41ff1e52acb9cc5bc25fa166bf4d95637f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 14:09:41 +0900 Subject: [PATCH] Fix migration not working correctly when applying on a default skin --- osu.Game/Screens/Play/SongProgress.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 592071b02e..35d70976d2 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -162,7 +162,6 @@ namespace osu.Game.Screens.Play if (!configShowGraph.IsDefault) { ShowGraph.Value = configShowGraph.Value; - configShowGraph.SetDefault(); // This is pretty ugly, but the only way to make this stick... if (skinManager != null) @@ -171,17 +170,17 @@ namespace osu.Game.Screens.Play if (skinnableTarget != null) { - skinManager.EnsureMutableSkin(); + // If the skin is not mutable, a mutable instance will be created, causing this migration logic to run again on the correct skin. + // Therefore we want to avoid resetting the config value on this invocation. + if (skinManager.EnsureMutableSkin()) + return; - // If `EnsureMutableSkin` actually changed the skin, default layout may take a frame to apply. - // See `SkinnableTargetComponentsContainer`'s use of ScheduleAfterChildren. - ScheduleAfterChildren(() => - { - var skin = skinManager.CurrentSkin.Value; - skin.UpdateDrawableTarget(skinnableTarget); + var skin = skinManager.CurrentSkin.Value; + skin.UpdateDrawableTarget(skinnableTarget); - skinManager.Save(skin); - }); + skinManager.Save(skin); + + configShowGraph.SetDefault(); } } }