Move clone to earlier in the process

This commit is contained in:
Dean Herbert 2021-07-19 19:18:04 +09:00
parent caba78cb5d
commit f16b4957aa
3 changed files with 8 additions and 8 deletions

View File

@ -694,9 +694,11 @@ namespace osu.Game.Screens.Play
/// <returns>The final score.</returns> /// <returns>The final score.</returns>
private async Task<ScoreInfo> prepareScoreForResults() private async Task<ScoreInfo> prepareScoreForResults()
{ {
var scoreCopy = Score.DeepClone();
try try
{ {
await PrepareScoreForResultsAsync(Score).ConfigureAwait(false); await PrepareScoreForResultsAsync(scoreCopy).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -705,14 +707,14 @@ namespace osu.Game.Screens.Play
try try
{ {
await ImportScore(Score).ConfigureAwait(false); await ImportScore(scoreCopy).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Error(ex, @"Score import failed!"); Logger.Error(ex, @"Score import failed!");
} }
return Score.ScoreInfo; return scoreCopy.ScoreInfo;
} }
/// <summary> /// <summary>

View File

@ -38,15 +38,13 @@ namespace osu.Game.Screens.Play
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token) protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
{ {
var scoreCopy = score.DeepClone(); var beatmap = score.ScoreInfo.Beatmap;
var beatmap = scoreCopy.ScoreInfo.Beatmap;
Debug.Assert(beatmap.OnlineBeatmapID != null); Debug.Assert(beatmap.OnlineBeatmapID != null);
int beatmapId = beatmap.OnlineBeatmapID.Value; int beatmapId = beatmap.OnlineBeatmapID.Value;
return new SubmitSoloScoreRequest(beatmapId, token, scoreCopy.ScoreInfo); return new SubmitSoloScoreRequest(beatmapId, token, score.ScoreInfo);
} }
} }
} }

View File

@ -116,7 +116,7 @@ namespace osu.Game.Screens.Play
{ {
var exiting = base.OnExiting(next); var exiting = base.OnExiting(next);
submitScore(Score); submitScore(Score.DeepClone());
return exiting; return exiting;
} }