Merge pull request #6010 from peppy/fix-config-disposal

Dispose config managers ahead of time to avoid database errors
This commit is contained in:
Dan Balasescu 2019-09-06 11:24:54 +09:00 committed by GitHub
commit d1f04639fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -207,6 +207,7 @@ namespace osu.Game
FileStore.Cleanup();
AddInternal(API);
AddInternal(RulesetConfigCache);
GlobalActionContainer globalBinding;

View File

@ -36,5 +36,14 @@ namespace osu.Game.Rulesets
return configCache.GetOrAdd(ruleset.RulesetInfo.ID.Value, _ => ruleset.CreateConfig(settingsStore));
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
// ensures any potential database operations are finalised before game destruction.
foreach (var c in configCache.Values)
(c as IDisposable)?.Dispose();
}
}
}