mirror of
https://github.com/ppy/osu
synced 2025-02-04 04:11:54 +00:00
Merge pull request #23661 from peppy/fix-multiplayer-present-crash
Fix `OnResume` / `OnSuspending` potentially getting called before `OnEntering` on a sub screen
This commit is contained in:
commit
812def124f
@ -132,7 +132,12 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
this.ScaleTo(1, 250, Easing.OutSine);
|
||||
|
||||
Debug.Assert(screenStack.CurrentScreen != null);
|
||||
screenStack.CurrentScreen.OnResuming(e);
|
||||
|
||||
// if a subscreen was pushed to the nested stack while the stack was not present, this path will proxy `OnResuming()`
|
||||
// to the subscreen before `OnEntering()` can even be called for the subscreen, breaking ordering expectations.
|
||||
// to work around this, do not proxy resume to screens that haven't loaded yet.
|
||||
if ((screenStack.CurrentScreen as Drawable)?.IsLoaded == true)
|
||||
screenStack.CurrentScreen.OnResuming(e);
|
||||
|
||||
base.OnResuming(e);
|
||||
}
|
||||
@ -143,7 +148,12 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
this.FadeOut(250);
|
||||
|
||||
Debug.Assert(screenStack.CurrentScreen != null);
|
||||
screenStack.CurrentScreen.OnSuspending(e);
|
||||
|
||||
// if a subscreen was pushed to the nested stack while the stack was not present, this path will proxy `OnSuspending()`
|
||||
// to the subscreen before `OnEntering()` can even be called for the subscreen, breaking ordering expectations.
|
||||
// to work around this, do not proxy suspend to screens that haven't loaded yet.
|
||||
if ((screenStack.CurrentScreen as Drawable)?.IsLoaded == true)
|
||||
screenStack.CurrentScreen.OnSuspending(e);
|
||||
}
|
||||
|
||||
public override bool OnExiting(ScreenExitEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user