1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 04:19:53 +08:00

Merge branch 'master' into judgement-revamp

This commit is contained in:
Dan Balasescu
2017-09-12 19:13:33 +09:00
committed by GitHub
Unverified
3 changed files with 21 additions and 5 deletions
+9 -2
View File
@@ -109,10 +109,17 @@ namespace osu.Game.Beatmaps
public virtual void Dispose()
{
track?.Dispose();
track = null;
background?.Dispose();
background = null;
}
public void DisposeTrack()
{
lock (trackLock)
{
track?.Dispose();
track = null;
}
}
}
}
+11 -2
View File
@@ -152,10 +152,19 @@ namespace osu.Game
Beatmap.ValueChanged += b =>
{
var trackLoaded = lastBeatmap?.TrackLoaded ?? false;
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
if (lastBeatmap?.Track != b.Track)
if (!trackLoaded || lastBeatmap?.Track != b.Track)
{
lastBeatmap?.Track?.Dispose();
if (trackLoaded)
{
Debug.Assert(lastBeatmap != null);
Debug.Assert(lastBeatmap.Track != null);
lastBeatmap.DisposeTrack();
}
Audio.Track.AddItem(b.Track);
}