1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:07:25 +08:00

Merge pull request #3852 from peppy/fix-exit-crash

Fix crash on exiting player during results transition
This commit is contained in:
Dean Herbert 2018-12-14 19:40:54 +09:00 committed by GitHub
commit 578f7ff459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,7 +170,7 @@ namespace osu.Game.Screens.Play
{ {
Retries = RestartCount, Retries = RestartCount,
OnRetry = Restart, OnRetry = Restart,
OnQuit = Exit, OnQuit = performUserRequestedExit,
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
Children = new[] Children = new[]
{ {
@ -211,7 +211,7 @@ namespace osu.Game.Screens.Play
failOverlay = new FailOverlay failOverlay = new FailOverlay
{ {
OnRetry = Restart, OnRetry = Restart,
OnQuit = Exit, OnQuit = performUserRequestedExit,
}, },
new HotkeyRetryOverlay new HotkeyRetryOverlay
{ {
@ -225,7 +225,7 @@ namespace osu.Game.Screens.Play
} }
}; };
hudOverlay.HoldToQuit.Action = Exit; hudOverlay.HoldToQuit.Action = performUserRequestedExit;
hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);
@ -250,8 +250,16 @@ namespace osu.Game.Screens.Play
mod.ApplyToClock(sourceClock); mod.ApplyToClock(sourceClock);
} }
private void performUserRequestedExit()
{
if (!IsCurrentScreen) return;
Exit();
}
public void Restart() public void Restart()
{ {
if (!IsCurrentScreen) return;
sampleRestart?.Play(); sampleRestart?.Play();
ValidForResume = false; ValidForResume = false;
RestartRequested?.Invoke(); RestartRequested?.Invoke();