Fix EditorClock retaining a reference to potentially outdated ControlPointInfo

This commit is contained in:
Dean Herbert
2021-09-14 23:56:57 +09:00
parent 563bf92529
commit 13f88cbc4e
2 changed files with 8 additions and 17 deletions

View File

@ -25,7 +25,9 @@ namespace osu.Game.Screens.Edit
public double TrackLength => track.Value?.Length ?? 60000;
public ControlPointInfo ControlPointInfo;
public ControlPointInfo ControlPointInfo => Beatmap.ControlPointInfo;
public IBeatmap Beatmap { get; set; }
private readonly BindableBeatDivisor beatDivisor;
@ -42,25 +44,15 @@ namespace osu.Game.Screens.Edit
/// </summary>
public bool IsSeeking { get; private set; }
public EditorClock(IBeatmap beatmap, BindableBeatDivisor beatDivisor)
: this(beatmap.ControlPointInfo, beatDivisor)
public EditorClock(IBeatmap beatmap = null, BindableBeatDivisor beatDivisor = null)
{
}
Beatmap = beatmap ?? new Beatmap();
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
{
this.beatDivisor = beatDivisor;
ControlPointInfo = controlPointInfo;
this.beatDivisor = beatDivisor ?? new BindableBeatDivisor();
underlyingClock = new DecoupleableInterpolatingFramedClock();
}
public EditorClock()
: this(new ControlPointInfo(), new BindableBeatDivisor())
{
}
/// <summary>
/// Seek to the closest snappable beat from a time.
/// </summary>