From 7809566f166e847b80723bf2bab3bc9f6a190f40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 23:31:38 +0900 Subject: [PATCH] Add explanatory comments --- osu.Game/Database/EFToRealmMigrator.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index aa25c76943..74a3edc3ee 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -133,6 +133,9 @@ namespace osu.Game.Database Task.Factory.StartNew(() => { realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm"), realmBlockOperations); + + // Above call will dispose of the blocking token when done. + // Clean up here so we don't accidentally dispose twice. realmBlockOperations = null; efContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.db")); @@ -220,6 +223,7 @@ namespace osu.Game.Database // If we were to not do this, the migration would run another time the next time the user starts the game. deletePreRealmData(); + // If something went wrong and the disposal token wasn't invoked above, ensure it is here. realmBlockOperations?.Dispose(); migrationCompleted.SetResult(true);