1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 13:23:05 +08:00

Fix crash when switching ladder match selection multiple times

This commit is contained in:
Dean Herbert 2023-07-24 20:44:50 +09:00
parent e0c0797f55
commit 4fdf885959

View File

@ -62,22 +62,28 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
// ensure any ongoing edits are committed out to the *current* selection before changing to a new one. // ensure any ongoing edits are committed out to the *current* selection before changing to a new one.
GetContainingInputManager().TriggerFocusContention(null); GetContainingInputManager().TriggerFocusContention(null);
roundDropdown.Current = selection.NewValue?.Round; // Required to avoid cyclic failure in BindableWithCurrent (TriggerChange called during the Current_Set process).
losersCheckbox.Current = selection.NewValue?.Losers; // Arguable a framework issue but since we haven't hit it anywhere else a local workaround seems best.
dateTimeBox.Current = selection.NewValue?.Date; roundDropdown.Current.ValueChanged -= roundDropdownChanged;
team1Dropdown.Current = selection.NewValue?.Team1; roundDropdown.Current = selection.NewValue.Round;
team2Dropdown.Current = selection.NewValue?.Team2; losersCheckbox.Current = selection.NewValue.Losers;
dateTimeBox.Current = selection.NewValue.Date;
team1Dropdown.Current = selection.NewValue.Team1;
team2Dropdown.Current = selection.NewValue.Team2;
roundDropdown.Current.ValueChanged += roundDropdownChanged;
}; };
}
roundDropdown.Current.ValueChanged += round => private void roundDropdownChanged(ValueChangedEvent<TournamentRound> round)
{ {
if (editorInfo.Selected.Value?.Date.Value < round.NewValue?.StartDate.Value) if (editorInfo.Selected.Value?.Date.Value < round.NewValue?.StartDate.Value)
{ {
editorInfo.Selected.Value.Date.Value = round.NewValue.StartDate.Value; editorInfo.Selected.Value.Date.Value = round.NewValue.StartDate.Value;
editorInfo.Selected.TriggerChange(); editorInfo.Selected.TriggerChange();
} }
};
} }
protected override void LoadComplete() protected override void LoadComplete()