Fix potential crash during shutdown sequence if intro playback was aborted

Fixes one of the audio related `ObjectDisposedException`s
(https://sentry.ppy.sh/organizations/ppy/issues/92/events/12f282f048cb4a4fae85810e8a70b68d/?project=2&query=is%3Aunresolved&sort=freq&statsPeriod=7d).

Ran into this while testing locally. See
`IntroScreen.ensureEventuallyArrivingAtMenu` for the related cause of
this happening (forced continuing to next screen if the intro doesn't
load in time).
This commit is contained in:
Dean Herbert 2022-07-12 14:54:45 +09:00
parent 9e40e50d93
commit cafe30fc4d

View File

@ -72,9 +72,16 @@ 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 the game may already be in a disposing state
// which will trigger errors during attempted audio playback.
if (DidLoadMenu)
return;
if (!UsingThemedIntro)
welcome?.Play();