Skip to content

Commit

Permalink
Fix song select potentially starting play before the carousel (and bi…
Browse files Browse the repository at this point in the history
…ndables) have been initialised
  • Loading branch information
peppy committed Mar 21, 2019
1 parent 4789aa8 commit a10e434
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions osu.Game/Screens/Select/SongSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ public void Edit(BeatmapInfo beatmap = null)
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
{
// This is very important as we have not yet bound to screen-level bindables before the carousel load is completed.
if (!Carousel.BeatmapSetsLoaded)
return;

// if we have a pending filter operation, we want to run it now.
// it could change selection (ie. if the ruleset has been changed).
Carousel.FlushPendingFilterOperations();
Expand Down Expand Up @@ -610,19 +614,19 @@ private void carouselBeatmapsLoaded()
private bool boundLocalBindables;

private void bindBindables()
{
{
if (boundLocalBindables)
return;

// manual binding to parent ruleset to allow for delayed load in the incoming direction.
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);

decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;

Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true);
Beatmap.BindValueChanged(workingBeatmapChanged);
Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true);
Beatmap.BindValueChanged(workingBeatmapChanged);

boundLocalBindables = true;
}
Expand Down

0 comments on commit a10e434

Please sign in to comment.