mirror of
https://github.com/ppy/osu
synced 2025-01-19 04:20:59 +00: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));
|
||||
|
||||
Host.UpdateThreadPausing += () =>
|
||||
{
|
||||
var blocking = realmFactory.BlockAllOperations();
|
||||
Schedule(() => blocking.Dispose());
|
||||
};
|
||||
Host.UpdateThread.ThreadPausing += onUpdateThreadPausing;
|
||||
|
||||
AddInternal(realmFactory);
|
||||
|
||||
@ -363,6 +359,12 @@ namespace osu.Game
|
||||
Ruleset.BindValueChanged(onRulesetChanged);
|
||||
}
|
||||
|
||||
private void onUpdateThreadPausing()
|
||||
{
|
||||
var blocking = realmFactory.BlockAllOperations();
|
||||
Schedule(() => blocking.Dispose());
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -496,6 +498,9 @@ namespace osu.Game
|
||||
LocalConfig?.Dispose();
|
||||
|
||||
contextFactory.FlushConnections();
|
||||
|
||||
if (Host != null)
|
||||
Host.UpdateThread.ThreadPausing -= onUpdateThreadPausing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user