Merge pull request #19079 from peppy/fix-audio-playback-disposed

Fix potential crash during shutdown sequence if intro playback was aborted
This commit is contained in:
Dan Balasescu 2022-07-12 17:29:23 +09:00 committed by GitHub
commit bd6f8bde9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,9 +72,17 @@ namespace osu.Game.Screens.Menu
RelativeSizeAxes = Axes.Both,
Clock = decoupledClock,
LoadMenu = LoadMenu
}, t =>
}, _ =>
{
AddInternal(t);
AddInternal(intro);
// There is a chance that the intro timed out before being displayed, and this scheduled callback could
// happen during the outro rather than intro.
// In such a scenario, we don't want to play the intro sample, nor attempt to start the intro track
// (that may have already been since disposed by MusicController).
if (DidLoadMenu)
return;
if (!UsingThemedIntro)
welcome?.Play();