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 @@ private void scoreCompletionChanged(ValueChangedEvent<bool> completed)
/// <returns>The final score.</returns>
private async Task<ScoreInfo> prepareScoreForResults()
{
var scoreCopy = Score.DeepClone();
try
{
await PrepareScoreForResultsAsync(Score).ConfigureAwait(false);
await PrepareScoreForResultsAsync(scoreCopy).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -705,14 +707,14 @@ private async Task<ScoreInfo> prepareScoreForResults()
try
{
await ImportScore(Score).ConfigureAwait(false);
await ImportScore(scoreCopy).ConfigureAwait(false);
}
catch (Exception ex)
{
Logger.Error(ex, @"Score import failed!");
}
return Score.ScoreInfo;
return scoreCopy.ScoreInfo;
}
/// <summary>

View File

@ -38,15 +38,13 @@ protected override APIRequest<APIScoreToken> CreateTokenRequest()
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
{
var scoreCopy = score.DeepClone();
var beatmap = scoreCopy.ScoreInfo.Beatmap;
var beatmap = score.ScoreInfo.Beatmap;
Debug.Assert(beatmap.OnlineBeatmapID != null);
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 @@ public override bool OnExiting(IScreen next)
{
var exiting = base.OnExiting(next);
submitScore(Score);
submitScore(Score.DeepClone());
return exiting;
}