1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-03 02:31:25 +08:00

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.
This commit is contained in:
Bartłomiej Dach
2025-09-29 15:30:27 +02:00
Unverified
parent 68523a637a
commit 2c39e1e9db
2 changed files with 21 additions and 0 deletions
@@ -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());
@@ -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;
}
}