mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:12:56 +08:00
Merge remote-tracking branch 'origin/master' into labelled-text-box
This commit is contained in:
commit
127084ba74
@ -5,6 +5,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Database
|
||||
@ -115,7 +116,11 @@ namespace osu.Game.Database
|
||||
}
|
||||
}
|
||||
|
||||
private void recycleThreadContexts() => threadContexts = new ThreadLocal<OsuDbContext>(CreateContext);
|
||||
private void recycleThreadContexts()
|
||||
{
|
||||
threadContexts?.Values.ForEach(c => c.Dispose());
|
||||
threadContexts = new ThreadLocal<OsuDbContext>(CreateContext, true);
|
||||
}
|
||||
|
||||
protected virtual OsuDbContext CreateContext() => new OsuDbContext(storage.GetDatabaseConnectionString(database_name))
|
||||
{
|
||||
@ -127,8 +132,6 @@ namespace osu.Game.Database
|
||||
lock (writeLock)
|
||||
{
|
||||
recycleThreadContexts();
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
storage.DeleteDatabase(database_name);
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ namespace osu.Game
|
||||
// todo: we probably want a better (non-destructive) migrations/recovery process at a later point than this.
|
||||
contextFactory.ResetDatabase();
|
||||
|
||||
Logger.Log("Database purged successfully.", LoggingTarget.Database, LogLevel.Important);
|
||||
Logger.Log("Database purged successfully.", LoggingTarget.Database);
|
||||
|
||||
// only run once more, then hard bail.
|
||||
using (var db = contextFactory.GetForWrite(false))
|
||||
|
@ -79,8 +79,13 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
public override void Filter(FilterCriteria criteria)
|
||||
{
|
||||
base.Filter(criteria);
|
||||
InternalChildren.Sort((x, y) => x.CompareTo(criteria, y));
|
||||
InternalChildren.ForEach(c => c.Filter(criteria));
|
||||
|
||||
var children = new List<CarouselItem>(InternalChildren);
|
||||
|
||||
children.Sort((x, y) => x.CompareTo(criteria, y));
|
||||
children.ForEach(c => c.Filter(criteria));
|
||||
|
||||
InternalChildren = children;
|
||||
}
|
||||
|
||||
protected virtual void ChildItemStateChanged(CarouselItem item, CarouselItemState value)
|
||||
|
Loading…
Reference in New Issue
Block a user