mirror of
https://github.com/ppy/osu.git
synced 2026-06-04 22:14:27 +08:00
Fix missing ConfigureAwait causing Items to potentially be copied on non-update thread
This commit is contained in:
@@ -409,10 +409,10 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
|
||||
protected override async Task<IEnumerable<CarouselItem>> FilterAsync(bool clearExistingPanels = false)
|
||||
{
|
||||
var items = await base.FilterAsync(clearExistingPanels);
|
||||
var items = await base.FilterAsync(clearExistingPanels).ConfigureAwait(true);
|
||||
|
||||
if (FilterDelay != 0)
|
||||
await Task.Delay(FilterDelay);
|
||||
await Task.Delay(FilterDelay).ConfigureAwait(true);
|
||||
|
||||
PostFilterBeatmaps = items.Select(i => i.Model).OfType<BeatmapInfo>();
|
||||
return items;
|
||||
|
||||
@@ -12,6 +12,7 @@ using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions.TypeExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@@ -309,16 +310,17 @@ namespace osu.Game.Graphics.Carousel
|
||||
var cts = new CancellationTokenSource();
|
||||
|
||||
var previousCancellationSource = Interlocked.Exchange(ref cancellationSource, cts);
|
||||
await previousCancellationSource.CancelAsync().ConfigureAwait(false);
|
||||
await previousCancellationSource.CancelAsync().ConfigureAwait(true);
|
||||
|
||||
if (DebounceDelay > 0)
|
||||
{
|
||||
log($"Filter operation queued, waiting for {DebounceDelay} ms debounce");
|
||||
await Task.Delay(DebounceDelay, cts.Token).ConfigureAwait(false);
|
||||
await Task.Delay(DebounceDelay, cts.Token).ConfigureAwait(true);
|
||||
}
|
||||
|
||||
// Copy must be performed on update thread for now (see ConfigureAwait above).
|
||||
// Could potentially be optimised in the future if it becomes an issue.
|
||||
Debug.Assert(ThreadSafety.IsUpdateThread);
|
||||
List<CarouselItem> items = new List<CarouselItem>(Items.Select(m => new CarouselItem(m)));
|
||||
|
||||
await Task.Run(async () =>
|
||||
|
||||
Reference in New Issue
Block a user