From 040fa3aa1573432a021a078ad0f978ac3c36ee33 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Oct 2017 11:43:30 +0900 Subject: [PATCH] Fix import after direct download being scheduled to update thread Caused a stall as experienced in #1364. --- osu.Game/Beatmaps/BeatmapManager.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index f03531aba8..30d46fd966 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -246,9 +246,13 @@ namespace osu.Game.Beatmaps { downloadNotification.State = ProgressNotificationState.Completed; - using (var stream = new MemoryStream(data)) - using (var archive = new OszArchiveReader(stream)) - Import(archive); + Task.Factory.StartNew(() => + { + // This gets scheduled back to the update thread, but we want the import to run in the background. + using (var stream = new MemoryStream(data)) + using (var archive = new OszArchiveReader(stream)) + Import(archive); + }, TaskCreationOptions.LongRunning); currentDownloads.Remove(request); };