mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
Merge branch 'master' into judgement-fixes
This commit is contained in:
commit
c6b909e4a5
@ -135,7 +135,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Database
|
|||||||
// 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 @@ namespace osu.Game.Database
|
|||||||
/// <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();
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
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 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
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 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
playerWeakReferences.ForEachAlive(_ => count++);
|
playerWeakReferences.ForEachAlive(_ => count++);
|
||||||
return count == 1;
|
return count == 1;
|
||||||
});
|
}, "no leaked players");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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" />
|
||||||
|
Loading…
Reference in New Issue
Block a user