1
0
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:
Dean Herbert 2021-06-23 18:08:34 +09:00
parent e4d17bd757
commit d148656108

View File

@ -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;
} }
} }
} }