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:
parent
c07a1ec91e
commit
4c43c92329
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user