mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Ensure the main realm context is closed when the factory is disposed
This commit is contained in:
@ -36,6 +36,9 @@ namespace osu.Game.Database
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsDisposed)
|
||||
throw new InvalidOperationException($"Attempted to access {nameof(Context)} on a disposed context factory");
|
||||
|
||||
if (context == null)
|
||||
{
|
||||
context = createContext();
|
||||
@ -92,6 +95,14 @@ namespace osu.Game.Database
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
context?.Dispose();
|
||||
context = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A transaction used for making changes to realm data.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user