mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 09:20:02 +09:00
Fix carousel filter debounce causing a race condition
Clicking a ruleset button on toolbar would schedule a delayed filter of carousel, which could in turn trigger a beatmap change after pushing a Player. This resolves that by forcing any pending operations to complete.
This commit is contained in:
@ -198,13 +198,16 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void carouselRaisedStart()
|
||||
{
|
||||
var pendingSelection = selectionChangedDebounce;
|
||||
selectionChangedDebounce = null;
|
||||
if (carousel.PendingFilter)
|
||||
// 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.Filter(null, false);
|
||||
|
||||
if (pendingSelection?.Completed == false)
|
||||
if (selectionChangedDebounce?.Completed == false)
|
||||
{
|
||||
pendingSelection.RunTask();
|
||||
pendingSelection.Cancel(); // cancel the already scheduled task.
|
||||
selectionChangedDebounce.RunTask();
|
||||
selectionChangedDebounce.Cancel(); // cancel the already scheduled task.
|
||||
selectionChangedDebounce = null;
|
||||
}
|
||||
|
||||
OnSelected();
|
||||
|
Reference in New Issue
Block a user