Skip to content

Commit

Permalink
Fix initial skin state being stored wrong to undo history
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Sep 30, 2024
1 parent 16e69b0 commit 1f2f4a5
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions osu.Game/Overlays/SkinEditor/SkinEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,24 @@ private void skinChanged()
});

changeHandler?.Dispose();
changeHandler = null;

skins.EnsureMutableSkin();
// Schedule is required to ensure that all layout in `LoadComplete` methods has been completed
// before storing an undo state.
//
// See https://github.com/ppy/osu/blob/8e6a4559e3ae8c9892866cf9cf8d4e8d1b72afd0/osu.Game/Skinning/SkinReloadableDrawable.cs#L76.
Schedule(() =>
{
var targetContainer = getTarget(selectedTarget.Value);
var targetContainer = getTarget(selectedTarget.Value);
if (targetContainer != null)
changeHandler = new SkinEditorChangeHandler(targetContainer);
if (targetContainer != null)
changeHandler = new SkinEditorChangeHandler(targetContainer);
hasBegunMutating = true;
hasBegunMutating = true;
// Reload sidebar components.
selectedTarget.TriggerChange();
// Reload sidebar components.
selectedTarget.TriggerChange();
});
}

/// <summary>
Expand Down

0 comments on commit 1f2f4a5

Please sign in to comment.