mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge pull request #19393 from peppy/fix-statistics-panel
Avoid potential realm fetch after disposal in `StatisticsPanel`
This commit is contained in:
commit
412d42b907
@ -11,6 +11,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
@ -90,18 +91,16 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
spinner.Show();
|
||||
|
||||
var localCancellationSource = loadCancellation = new CancellationTokenSource();
|
||||
IBeatmap playableBeatmap = null;
|
||||
|
||||
var workingBeatmap = beatmapManager.GetWorkingBeatmap(newScore.BeatmapInfo);
|
||||
|
||||
// Todo: The placement of this is temporary. Eventually we'll both generate the playable beatmap _and_ run through it in a background task to generate the hit events.
|
||||
Task.Run(() =>
|
||||
{
|
||||
playableBeatmap = beatmapManager.GetWorkingBeatmap(newScore.BeatmapInfo).GetPlayableBeatmap(newScore.Ruleset, newScore.Mods);
|
||||
}, loadCancellation.Token).ContinueWith(_ => Schedule(() =>
|
||||
Task.Run(() => workingBeatmap.GetPlayableBeatmap(newScore.Ruleset, newScore.Mods), loadCancellation.Token).ContinueWith(task => Schedule(() =>
|
||||
{
|
||||
bool hitEventsAvailable = newScore.HitEvents.Count != 0;
|
||||
Container<Drawable> container;
|
||||
|
||||
var statisticRows = newScore.Ruleset.CreateInstance().CreateStatisticsForScore(newScore, playableBeatmap);
|
||||
var statisticRows = newScore.Ruleset.CreateInstance().CreateStatisticsForScore(newScore, task.GetResultSafely());
|
||||
|
||||
if (!hitEventsAvailable && statisticRows.SelectMany(r => r.Columns).All(c => c.RequiresHitEvents))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user