mirror of
https://github.com/ppy/osu.git
synced 2025-01-16 15:33:20 +08:00
Reduce lifetime of realm context usage in detach scenario
This commit is contained in:
parent
8d071f97fb
commit
fd582f521c
@ -37,9 +37,10 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
{
|
{
|
||||||
var rulesetId = Ruleset?.ID;
|
var rulesetId = Ruleset?.ID;
|
||||||
|
|
||||||
|
List<RealmKeyBinding> bindings;
|
||||||
|
|
||||||
using (var realm = realmFactory.GetForRead())
|
using (var realm = realmFactory.GetForRead())
|
||||||
{
|
bindings = realm.All<RealmKeyBinding>().Where(b => b.RulesetID == rulesetId && b.Variant == variant).Detach();
|
||||||
var bindings = realm.All<RealmKeyBinding>().Where(b => b.RulesetID == rulesetId && b.Variant == variant).Detach();
|
|
||||||
|
|
||||||
foreach (var defaultGroup in Defaults.GroupBy(d => d.Action))
|
foreach (var defaultGroup in Defaults.GroupBy(d => d.Action))
|
||||||
{
|
{
|
||||||
@ -52,7 +53,6 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
Defaults = defaultGroup.Select(d => d.KeyCombination)
|
Defaults = defaultGroup.Select(d => d.KeyCombination)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Add(new ResetButton
|
Add(new ResetButton
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user