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

Fix SkinEditorOverlay freezing when ReplayPlayer screen exits early

Originally when popping in, the ReplayPlayer was loaded first (if previous screen was MainMenu), and afterwards the SkinEditor component was loaded asynchronously. However, if the ReplayPlayer screen exits quickly (like in the event the beatmap has no objects), the skin editor component has not finished initializing (this is before it was even added to the component tree, so it's still not marked `Visible`), then the screen exiting will cause `OsuGame` to call SetTarget(newScreen) -> setTarget(...) which sees that the cached `skinEditor` is not visible yet, and hides/nulls the field. This is the point where LoadComponentAsync(editor, ...) finishes, and the callback sees that the cached skinEditor field is now different (null) than the one that was loaded, and never adds it to the component tree. This occurrence is unhandled and as such the SkinEditorOverlay never hides itself, consuming all input infinitely.

This PR changes the loading to start loading the ReplayPlayer *after* the SkinEditor has been loaded and added to the component tree.
Additionally, this lowers the exit delay for ReplayPlayer and changes the "no hit objects" notification to not be an error since it's a controlled exit.
This commit is contained in:
rushiiMachine 2023-12-26 11:08:21 -08:00
parent 668ce937a8
commit 1d4db3b7a9
No known key found for this signature in database
GPG Key ID: DCBE5952BB3B6420
2 changed files with 5 additions and 5 deletions

View File

@ -100,9 +100,6 @@ namespace osu.Game.Overlays.SkinEditor
{
globallyDisableBeatmapSkinSetting();
if (lastTargetScreen is MainMenu)
PresentGameplay();
if (skinEditor != null)
{
skinEditor.Show();
@ -122,6 +119,9 @@ namespace osu.Game.Overlays.SkinEditor
AddInternal(editor);
if (lastTargetScreen is MainMenu)
PresentGameplay();
Debug.Assert(lastTargetScreen != null);
SetTarget(lastTargetScreen);
@ -316,7 +316,7 @@ namespace osu.Game.Overlays.SkinEditor
base.LoadComplete();
if (!LoadedBeatmapSuccessfully)
Scheduler.AddDelayed(this.Exit, 3000);
Scheduler.AddDelayed(this.Exit, RESULTS_DISPLAY_DELAY);
}
protected override void Update()

View File

@ -547,7 +547,7 @@ namespace osu.Game.Screens.Play
if (playable.HitObjects.Count == 0)
{
Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Error);
Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Important);
return null;
}
}