From 2c39e1e9dbcae17cad677f0a00e28b72df4f5e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 29 Sep 2025 15:30:27 +0200 Subject: [PATCH] Ensure submission progress sample is stopped when transitioning into a final state Probably closes https://github.com/ppy/osu/issues/35138. I'm not sure. I only got the issue to reproduce once, on dev, using a very large archive that was uploading really slowly, and then never again. The working theory is that basically handling of `progressSampleChannel` is quite dodgy and it could possibly, in circumstances unknown, be allowed to play forevermore after transitioning to failed / canceled state. Success state does not get this treatment because it has special logic to set progress to 1. --- .../TestSceneSubmissionStageProgress.cs | 19 +++++++++++++++++++ .../Submission/SubmissionStageProgress.cs | 2 ++ 2 files changed, 21 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneSubmissionStageProgress.cs b/osu.Game.Tests/Visual/Editing/TestSceneSubmissionStageProgress.cs index ee22cbda71..2dc9077a14 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneSubmissionStageProgress.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneSubmissionStageProgress.cs @@ -68,6 +68,25 @@ namespace osu.Game.Tests.Visual.Editing progress.SetInProgress(incrementingProgress += RNG.NextSingle(0.08f)); }, 0, true); }); + AddStep("increase progress slowly then fail", () => + { + incrementingProgress = 0; + + ScheduledDelegate? task = null; + + task = Scheduler.AddDelayed(() => + { + if (incrementingProgress >= 1) + { + progress.SetFailed("nope"); + // ReSharper disable once AccessToModifiedClosure + task?.Cancel(); + return; + } + + progress.SetInProgress(incrementingProgress += RNG.NextSingle(0.001f)); + }, 0, true); + }); AddUntilStep("wait for completed", () => incrementingProgress >= 1); AddStep("completed", () => progress.SetCompleted()); diff --git a/osu.Game/Screens/Edit/Submission/SubmissionStageProgress.cs b/osu.Game/Screens/Edit/Submission/SubmissionStageProgress.cs index 8af4e3fe52..e7f8ff933d 100644 --- a/osu.Game/Screens/Edit/Submission/SubmissionStageProgress.cs +++ b/osu.Game/Screens/Edit/Submission/SubmissionStageProgress.cs @@ -263,6 +263,7 @@ namespace osu.Game.Screens.Edit.Submission iconContainer.Colour = colours.Red1; iconContainer.FlashColour(Colour4.White, 1000, Easing.OutQuint); errorSample?.Play(); + progressSampleChannel?.Stop(); break; case StageStatusType.Canceled: @@ -274,6 +275,7 @@ namespace osu.Game.Screens.Edit.Submission iconContainer.Colour = colours.Gray8; iconContainer.FlashColour(Colour4.White, 1000, Easing.OutQuint); cancelSample?.Play(); + progressSampleChannel?.Stop(); break; } }