Merge branch 'master' into judgement-fixes

This commit is contained in:
Dean Herbert 2018-09-14 04:03:54 +09:00 committed by GitHub
commit c6b909e4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View File

@ -135,7 +135,7 @@ public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset)
public bool BackgroundLoaded => background.IsResultAvailable; public bool BackgroundLoaded => background.IsResultAvailable;
public Texture Background => background.Value; 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(); protected abstract Texture GetBackground();
private readonly RecyclableLazy<Texture> background; private readonly RecyclableLazy<Texture> background;

View File

@ -59,7 +59,7 @@ public abstract class ArchiveModelManager<TModel, TFileModel> : ICanAcceptFiles
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private ArchiveImportIPCChannel ipc; private ArchiveImportIPCChannel ipc;
private readonly List<Action> cachedEvents = new List<Action>(); private readonly List<Action> queuedEvents = new List<Action>();
/// <summary> /// <summary>
/// Allows delaying of outwards events until an operation is confirmed (at a database level). /// Allows delaying of outwards events until an operation is confirmed (at a database level).
@ -77,20 +77,26 @@ public abstract class ArchiveModelManager<TModel, TFileModel> : ICanAcceptFiles
/// <param name="perform">Whether the flushed events should be performed.</param> /// <param name="perform">Whether the flushed events should be performed.</param>
private void flushEvents(bool perform) private void flushEvents(bool perform)
{ {
Action[] events;
lock (queuedEvents)
{
events = queuedEvents.ToArray();
queuedEvents.Clear();
}
if (perform) if (perform)
{ {
foreach (var a in cachedEvents) foreach (var a in events)
a.Invoke(); a.Invoke();
} }
cachedEvents.Clear();
delayingEvents = false; delayingEvents = false;
} }
private void handleEvent(Action a) private void handleEvent(Action a)
{ {
if (delayingEvents) if (delayingEvents)
cachedEvents.Add(a); lock (queuedEvents) queuedEvents.Add(a);
else else
a.Invoke(); a.Invoke();
} }

View File

@ -54,7 +54,7 @@ private void load(RulesetStore rulesets)
AddStep(r.Name, () => p = loadPlayerFor(r)); AddStep(r.Name, () => p = loadPlayerFor(r));
AddUntilStep(() => ContinueCondition(p)); AddUntilStep(() => ContinueCondition(p));
AddAssert("no leaked beatmaps", () => AddUntilStep(() =>
{ {
p = null; p = null;
@ -64,9 +64,9 @@ private void load(RulesetStore rulesets)
workingWeakReferences.ForEachAlive(_ => count++); workingWeakReferences.ForEachAlive(_ => count++);
return count == 1; return count == 1;
}); }, "no leaked beatmaps");
AddAssert("no leaked players", () => AddUntilStep(() =>
{ {
GC.Collect(); GC.Collect();
GC.WaitForPendingFinalizers(); GC.WaitForPendingFinalizers();
@ -74,7 +74,7 @@ private void load(RulesetStore rulesets)
playerWeakReferences.ForEachAlive(_ => count++); playerWeakReferences.ForEachAlive(_ => count++);
return count == 1; return count == 1;
}); }, "no leaked players");
} }
} }
} }

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.910.1" /> <PackageReference Include="ppy.osu.Framework" Version="2018.913.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" /> <PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />