mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Add extra extra safety against attempting to load a previously expired editor
This commit is contained in:
parent
b1a444180f
commit
ef49f2ed0e
@ -73,15 +73,23 @@ namespace osu.Game.Skinning.Editor
|
|||||||
var editor = new SkinEditor(target);
|
var editor = new SkinEditor(target);
|
||||||
editor.State.BindValueChanged(editorVisibilityChanged);
|
editor.State.BindValueChanged(editorVisibilityChanged);
|
||||||
|
|
||||||
|
skinEditor = editor;
|
||||||
|
|
||||||
// Schedule ensures that if `Show` is called before this overlay is loaded,
|
// 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).
|
// it will not throw (LoadComponentAsync requires the load target to be in a loaded state).
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
Debug.Assert(editor != null);
|
if (editor != skinEditor)
|
||||||
LoadComponentAsync(editor, AddInternal);
|
return;
|
||||||
});
|
|
||||||
|
|
||||||
skinEditor = editor;
|
LoadComponentAsync(editor, _ =>
|
||||||
|
{
|
||||||
|
if (editor != skinEditor)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AddInternal(editor);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
skinEditor.Show();
|
skinEditor.Show();
|
||||||
|
Loading…
Reference in New Issue
Block a user