1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Fix holding a selection while changing screens causing a crash

This commit is contained in:
Dean Herbert 2023-02-07 16:07:33 +09:00
parent 71eef238c4
commit dad348111d

View File

@ -481,8 +481,16 @@ namespace osu.Game.Overlays.SkinEditor
remove => throw new NotImplementedException();
}
public void BeginChange() => changeHandler?.BeginChange();
public void EndChange() => changeHandler?.EndChange();
private IEditorChangeHandler? beginChangeHandler;
public void BeginChange()
{
// Change handler may change between begin and end, which can cause unbalanced operations.
// Let's track the one that was used when beginning the change so we can call EndChange on it specifically.
(beginChangeHandler = changeHandler)?.BeginChange();
}
public void EndChange() => beginChangeHandler?.EndChange();
public void SaveState() => changeHandler?.SaveState();
#endregion