From d602aebebbf01c8952c5d27f1eaa9a90e441fb83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Dec 2021 18:58:31 +0900 Subject: [PATCH] Add missing cancellation token and rename load task variable to match purpose --- osu.Game/Overlays/BeatmapListingOverlay.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/BeatmapListingOverlay.cs b/osu.Game/Overlays/BeatmapListingOverlay.cs index 074db5cef9..ab4ff3edc2 100644 --- a/osu.Game/Overlays/BeatmapListingOverlay.cs +++ b/osu.Game/Overlays/BeatmapListingOverlay.cs @@ -131,7 +131,7 @@ namespace osu.Game.Overlays Loading.Show(); } - private Task panelLoadDelegate; + private Task panelLoadTask; private void onSearchFinished(BeatmapListingFilterControl.SearchResult searchResult) { @@ -155,16 +155,16 @@ namespace osu.Game.Overlays var content = createCardContainerFor(newCards); - panelLoadDelegate = LoadComponentAsync(foundContent = content, addContentToPlaceholder, (cancellationToken = new CancellationTokenSource()).Token); + panelLoadTask = LoadComponentAsync(foundContent = content, addContentToPlaceholder, (cancellationToken = new CancellationTokenSource()).Token); } else { - panelLoadDelegate = LoadComponentsAsync(newCards, loaded => + panelLoadTask = LoadComponentsAsync(newCards, loaded => { lastFetchDisplayedTime = Time.Current; foundContent.AddRange(loaded); loaded.ForEach(p => p.FadeIn(200, Easing.OutQuint)); - }); + }, (cancellationToken = new CancellationTokenSource()).Token); } } @@ -239,7 +239,7 @@ namespace osu.Game.Overlays var newCards = createCardsFor(foundContent.Reverse().Select(card => card.BeatmapSet)); - panelLoadDelegate = LoadComponentsAsync(newCards, cards => + panelLoadTask = LoadComponentsAsync(newCards, cards => { foundContent.Clear(); foundContent.AddRange(cards); @@ -374,7 +374,7 @@ namespace osu.Game.Overlays const int pagination_scroll_distance = 500; - bool shouldShowMore = panelLoadDelegate?.IsCompleted != false + bool shouldShowMore = panelLoadTask?.IsCompleted != false && Time.Current - lastFetchDisplayedTime > time_between_fetches && (ScrollFlow.ScrollableExtent > 0 && ScrollFlow.IsScrolledToEnd(pagination_scroll_distance));