Skip to content

Commit 4e96853

Browse files
authored
Merge pull request #24548 from peppy/fix-score-copy-instability
Fix score being cloned in async method causing random crashes
2 parents 526a145 + e8bde65 commit 4e96853

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

osu.Game/Screens/Play/Player.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,13 @@ private Task<ScoreInfo> prepareAndImportScoreAsync(bool forceImport = false)
810810
if (!canShowResults && !forceImport)
811811
return Task.FromResult<ScoreInfo>(null);
812812

813+
// Clone score before beginning any async processing.
814+
// - Must be run synchronously as the score may potentially be mutated in the background.
815+
// - Must be cloned for the same reason.
816+
Score scoreCopy = Score.DeepClone();
817+
813818
return prepareScoreForDisplayTask = Task.Run(async () =>
814819
{
815-
var scoreCopy = Score.DeepClone();
816-
817820
try
818821
{
819822
await PrepareScoreForResultsAsync(scoreCopy).ConfigureAwait(false);

0 commit comments

Comments
 (0)