1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Fix Show then Reset potentially resulting in incorrect load target

This commit is contained in:
Dean Herbert 2021-12-29 21:46:34 +09:00
parent 471eea750a
commit b1a444180f

View File

@ -70,16 +70,18 @@ namespace osu.Game.Skinning.Editor
// base call intentionally omitted.
if (skinEditor == null)
{
skinEditor = new SkinEditor(target);
skinEditor.State.BindValueChanged(editorVisibilityChanged);
var editor = new SkinEditor(target);
editor.State.BindValueChanged(editorVisibilityChanged);
// Schedule ensures that if `Show` is called before this overlay is loaded,
// it will not throw (LoadComponentAsync requires the load target to be in a loaded state).
Schedule(() =>
{
Debug.Assert(skinEditor != null);
LoadComponentAsync(skinEditor, AddInternal);
Debug.Assert(editor != null);
LoadComponentAsync(editor, AddInternal);
});
skinEditor = editor;
}
else
skinEditor.Show();