mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 23:12:56 +08:00
Fix some realm pieces not being cleaned up
This commit is contained in:
parent
92dd1bcddb
commit
8a0c8f5fd8
@ -49,9 +49,11 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
imported.First().PerformWrite(updated =>
|
imported.First().PerformWrite(updated =>
|
||||||
{
|
{
|
||||||
Logger.Log($"Beatmap \"{updated}\"update completed successfully", LoggingTarget.Database);
|
var realm = updated.Realm;
|
||||||
|
|
||||||
original = updated.Realm.Find<BeatmapSetInfo>(original.ID);
|
Logger.Log($"Beatmap \"{updated}\" update completed successfully", LoggingTarget.Database);
|
||||||
|
|
||||||
|
original = realm.Find<BeatmapSetInfo>(original.ID);
|
||||||
|
|
||||||
// Generally the import process will do this for us if the OnlineIDs match,
|
// Generally the import process will do this for us if the OnlineIDs match,
|
||||||
// but that isn't a guarantee (ie. if the .osu file doesn't have OnlineIDs populated).
|
// but that isn't a guarantee (ie. if the .osu file doesn't have OnlineIDs populated).
|
||||||
@ -80,6 +82,9 @@ namespace osu.Game.Beatmaps
|
|||||||
// interactions, like restoring the outdated beatmap then updating a second time
|
// interactions, like restoring the outdated beatmap then updating a second time
|
||||||
// (causing user data to be wiped).
|
// (causing user data to be wiped).
|
||||||
original.Beatmaps.Remove(beatmap);
|
original.Beatmaps.Remove(beatmap);
|
||||||
|
|
||||||
|
realm.Remove(beatmap.Metadata);
|
||||||
|
realm.Remove(beatmap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -89,6 +94,10 @@ namespace osu.Game.Beatmaps
|
|||||||
beatmap.ResetOnlineInfo();
|
beatmap.ResetOnlineInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the original has no beatmaps left, delete the set as well.
|
||||||
|
if (!original.Beatmaps.Any())
|
||||||
|
realm.Remove(original);
|
||||||
});
|
});
|
||||||
|
|
||||||
return imported;
|
return imported;
|
||||||
|
@ -278,7 +278,6 @@ namespace osu.Game.Database
|
|||||||
realm.Remove(score);
|
realm.Remove(score);
|
||||||
|
|
||||||
realm.Remove(beatmap.Metadata);
|
realm.Remove(beatmap.Metadata);
|
||||||
|
|
||||||
realm.Remove(beatmap);
|
realm.Remove(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user