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

Merge pull request #8355 from peppy/fix-invalid-push-from-player

Fix potentially invalid push in player while already exiting
This commit is contained in:
Dan Balasescu 2020-03-19 22:55:54 +09:00 committed by GitHub
commit aa49965cc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -387,6 +387,10 @@ namespace osu.Game.Screens.Play
private void onCompletion()
{
// screen may be in the exiting transition phase.
if (!this.IsCurrentScreen())
return;
// Only show the completion screen if the player hasn't failed
if (HealthProcessor.HasFailed || completionProgressDelegate != null)
return;
@ -581,7 +585,7 @@ namespace osu.Game.Screens.Play
if (completionProgressDelegate != null && !completionProgressDelegate.Cancelled && !completionProgressDelegate.Completed)
{
// proceed to result screen if beatmap already finished playing
scheduleGotoRanking();
completionProgressDelegate.RunTask();
return true;
}
@ -622,8 +626,16 @@ namespace osu.Game.Screens.Play
completionProgressDelegate = Schedule(delegate
{
var score = CreateScore();
if (DrawableRuleset.ReplayScore == null)
scoreManager.Import(score).ContinueWith(_ => Schedule(() => this.Push(CreateResults(score))));
{
scoreManager.Import(score).ContinueWith(_ => Schedule(() =>
{
// screen may be in the exiting transition phase.
if (this.IsCurrentScreen())
this.Push(CreateResults(score));
}));
}
else
this.Push(CreateResults(score));
});