1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 01:02:56 +08:00

ensure dispose stream

This commit is contained in:
cdwcgt 2023-08-02 17:48:24 +09:00
parent c07a1ec91e
commit 4c43c92329
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
2 changed files with 6 additions and 2 deletions

View File

@ -78,6 +78,8 @@ namespace osu.Game.Scoring
Performer?.PerformFromScreen(screen => screen.Push(new ReplayMissingBeatmapScreen(res, e.ScoreStream)));
};
req.Failure += _ => e.ScoreStream?.Dispose();
api.Queue(req);
}

View File

@ -174,16 +174,17 @@ namespace osu.Game.Screens.Import
if (beatmapSetInfo == null) return;
if (scoreStream == null) return;
if (scoreStream == null || !scoreStream.CanRead) return;
if (sender.Any(b => b.OnlineID == beatmapSetInfo.OnlineID))
{
var progressNotification = new ImportProgressNotification();
var importTask = new ImportTask(scoreStream, "score.osr");
scoreManager.Import(progressNotification, new[] { importTask })
.ContinueWith(s =>
{
scoreStream.Dispose();
s.GetResultSafely<IEnumerable<Live<ScoreInfo>>>().FirstOrDefault()?.PerformRead(score =>
{
Guid scoreid = score.ID;
@ -205,6 +206,7 @@ namespace osu.Game.Screens.Import
base.Dispose(isDisposing);
realmSubscription?.Dispose();
scoreStream?.Dispose();
}
}
}