1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 10:33:22 +08:00

Fix SkinEditor potentially initialising change handler while components are not loaded yet

This commit is contained in:
Bartłomiej Dach 2024-10-16 14:47:29 +02:00
parent 66ca744843
commit 936677f56a
No known key found for this signature in database

View File

@ -353,9 +353,10 @@ namespace osu.Game.Overlays.SkinEditor
return;
}
changeHandler = new SkinEditorChangeHandler(skinComponentsContainer);
changeHandler.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
changeHandler.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
if (skinComponentsContainer.IsLoaded)
bindChangeHandler(skinComponentsContainer);
else
skinComponentsContainer.OnLoadComplete += d => Schedule(() => bindChangeHandler((SkinnableContainer)d));
content.Child = new SkinBlueprintContainer(skinComponentsContainer);
@ -397,6 +398,13 @@ namespace osu.Game.Overlays.SkinEditor
SelectedComponents.Clear();
placeComponent(component);
}
void bindChangeHandler(SkinnableContainer skinnableContainer)
{
changeHandler = new SkinEditorChangeHandler(skinnableContainer);
changeHandler.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
changeHandler.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
}
}
private void skinChanged()