Skip to content

Commit

Permalink
Fix multiplayer song select not correctly applying filter sometimes
Browse files Browse the repository at this point in the history
Fixes the root client-side failure causing
#30415.

Thread of breakage is as follows:

1. `SongSelect` loads the carousel.
   At this point, the ruleset is what the ambient ruleset would have
   been at the time of pushing song select, so most likely it will
   match the current ruleset.
   Notably, the carousel is loaded with `AllowSelection == false`.
2. `OnlinePlaySongSelect` sets the ruleset to the one taken from
   the relevant playlist item in `LoadComplete()`.
3. At any point between the previous and the next step, the user
   changes the ruleset manually.
4. `SongSelect.carouselBeatmapsLoaded()` is ran, which calls
   `transferRulesetValue()`, which calls `FilterControl.FilterChanged`.
   But at this stage `Carousel.AllowSelection` is still false, so
   the filter is not executed, but `pendingFilterApplication` is set
   instead.
   Unfortunately, the pending filter never gets applied after that.
   The only place that checks that flag is `OnEntering()`, which at
   this point has already ran.

To fix, move the `pendingFilterApplication` check to `Update()`, which
seems like the most obvious and safe solution.
  • Loading branch information
bdach committed Oct 25, 2024
1 parent 36bcc58 commit b78e7d5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions osu.Game/Screens/Select/SongSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -711,12 +711,6 @@ public override void OnResuming(ScreenTransitionEvent e)

Carousel.AllowSelection = true;

if (pendingFilterApplication)
{
Carousel.Filter(FilterControl.CreateCriteria());
pendingFilterApplication = false;
}

BeatmapDetails.Refresh();

beginLooping();
Expand Down Expand Up @@ -749,6 +743,17 @@ public override void OnResuming(ScreenTransitionEvent e)
FilterControl.Activate();
}

protected override void Update()
{
base.Update();

if (Carousel.AllowSelection && pendingFilterApplication)
{
Carousel.Filter(FilterControl.CreateCriteria());
pendingFilterApplication = false;
}
}

public override void OnSuspending(ScreenTransitionEvent e)
{
// Handle the case where FinaliseSelection is never called (ie. when a screen is pushed externally).
Expand Down

0 comments on commit b78e7d5

Please sign in to comment.