From 55372496d117463c11e8e79043e0f1f1c6580956 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Sep 2018 22:37:15 +0900 Subject: [PATCH 1/4] Fix thread-safety of queued events list in ArchiveModelManager --- osu.Game/Database/ArchiveModelManager.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index e9fe943f15..f4f169f27c 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -59,7 +59,7 @@ public abstract class ArchiveModelManager : ICanAcceptFiles // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ArchiveImportIPCChannel ipc; - private readonly List cachedEvents = new List(); + private readonly List queuedEvents = new List(); /// /// Allows delaying of outwards events until an operation is confirmed (at a database level). @@ -77,20 +77,26 @@ public abstract class ArchiveModelManager : ICanAcceptFiles /// Whether the flushed events should be performed. private void flushEvents(bool perform) { + Action[] events; + lock (queuedEvents) + { + events = queuedEvents.ToArray(); + queuedEvents.Clear(); + } + if (perform) { - foreach (var a in cachedEvents) + foreach (var a in events) a.Invoke(); } - cachedEvents.Clear(); delayingEvents = false; } private void handleEvent(Action a) { if (delayingEvents) - cachedEvents.Add(a); + lock (queuedEvents) queuedEvents.Add(a); else a.Invoke(); } From 9b0954ab81a162971103867b0d967539a53d7215 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 11 Sep 2018 11:28:02 +0900 Subject: [PATCH 2/4] Reference whether texture is available rather than disposed --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index a2b44aab52..e0a22460ef 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -135,7 +135,7 @@ public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset) public bool BackgroundLoaded => background.IsResultAvailable; public Texture Background => background.Value; - protected virtual bool BackgroundStillValid(Texture b) => b == null || !b.IsDisposed; + protected virtual bool BackgroundStillValid(Texture b) => b == null || b.Available; protected abstract Texture GetBackground(); private readonly RecyclableLazy background; From 02313c6d6edeab0350cc22785bcb54220f6bdefa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Sep 2018 13:10:34 +0900 Subject: [PATCH 3/4] Wait longer before confirming test players are cleaned up --- osu.Game/Tests/Visual/TestCasePlayer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 9afb1dd6cd..9e499cb961 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -54,7 +54,7 @@ private void load(RulesetStore rulesets) AddStep(r.Name, () => p = loadPlayerFor(r)); AddUntilStep(() => ContinueCondition(p)); - AddAssert("no leaked beatmaps", () => + AddUntilStep(() => { p = null; @@ -64,9 +64,9 @@ private void load(RulesetStore rulesets) workingWeakReferences.ForEachAlive(_ => count++); return count == 1; - }); + }, "no leaked beatmaps"); - AddAssert("no leaked players", () => + AddUntilStep(() => { GC.Collect(); GC.WaitForPendingFinalizers(); @@ -74,7 +74,7 @@ private void load(RulesetStore rulesets) playerWeakReferences.ForEachAlive(_ => count++); return count == 1; - }); + }, "no leaked players"); } } } From 067bc39185149ac34be800fdbefdba7190539356 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Sep 2018 12:47:26 +0900 Subject: [PATCH 4/4] Update nuget package --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3e16e90d06..83ab5534c6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - +