mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 11:23:23 +08:00
Fix multiple disposals resulting in assert being hit
This commit is contained in:
parent
65418aca1a
commit
7efb4ce30a
@ -101,6 +101,16 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
AddUntilStep("wait for restore to complete", () => Game.Audio.Tracks.AggregateVolume.Value, () => Is.EqualTo(normalVolume).Within(float.Epsilon));
|
AddUntilStep("wait for restore to complete", () => Game.Audio.Tracks.AggregateVolume.Value, () => Is.EqualTo(normalVolume).Within(float.Epsilon));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultipleDisposalIsNoop()
|
||||||
|
{
|
||||||
|
IDisposable duckOp1 = null!;
|
||||||
|
|
||||||
|
AddStep("duck", () => duckOp1 = Game.MusicController.Duck());
|
||||||
|
AddStep("restore", () => duckOp1.Dispose());
|
||||||
|
AddStep("restore", () => duckOp1.Dispose());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestMultipleDucksDifferentPieces()
|
public void TestMultipleDucksDifferentPieces()
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -284,8 +283,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
void restoreDucking() => Schedule(() =>
|
void restoreDucking() => Schedule(() =>
|
||||||
{
|
{
|
||||||
Debug.Assert(duckOperations.Contains(parameters));
|
if (!duckOperations.Remove(parameters))
|
||||||
duckOperations.Remove(parameters);
|
return;
|
||||||
|
|
||||||
DuckParameters? restoreVolumeOperation = duckOperations.MinBy(p => p.DuckVolumeTo);
|
DuckParameters? restoreVolumeOperation = duckOperations.MinBy(p => p.DuckVolumeTo);
|
||||||
DuckParameters? restoreLowPassOperation = duckOperations.MinBy(p => p.DuckCutoffTo);
|
DuckParameters? restoreLowPassOperation = duckOperations.MinBy(p => p.DuckCutoffTo);
|
||||||
|
Loading…
Reference in New Issue
Block a user