mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 17:53:15 +08:00
Update in line with framework event structural changes (and add unbind)
This commit is contained in:
parent
e4d17bd757
commit
d148656108
@ -183,11 +183,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
dependencies.Cache(realmFactory = new RealmContextFactory(Storage));
|
dependencies.Cache(realmFactory = new RealmContextFactory(Storage));
|
||||||
|
|
||||||
Host.UpdateThreadPausing += () =>
|
Host.UpdateThread.ThreadPausing += onUpdateThreadPausing;
|
||||||
{
|
|
||||||
var blocking = realmFactory.BlockAllOperations();
|
|
||||||
Schedule(() => blocking.Dispose());
|
|
||||||
};
|
|
||||||
|
|
||||||
AddInternal(realmFactory);
|
AddInternal(realmFactory);
|
||||||
|
|
||||||
@ -363,6 +359,12 @@ namespace osu.Game
|
|||||||
Ruleset.BindValueChanged(onRulesetChanged);
|
Ruleset.BindValueChanged(onRulesetChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onUpdateThreadPausing()
|
||||||
|
{
|
||||||
|
var blocking = realmFactory.BlockAllOperations();
|
||||||
|
Schedule(() => blocking.Dispose());
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -496,6 +498,9 @@ namespace osu.Game
|
|||||||
LocalConfig?.Dispose();
|
LocalConfig?.Dispose();
|
||||||
|
|
||||||
contextFactory.FlushConnections();
|
contextFactory.FlushConnections();
|
||||||
|
|
||||||
|
if (Host != null)
|
||||||
|
Host.UpdateThread.ThreadPausing -= onUpdateThreadPausing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user