mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 00:47:24 +08:00
531794b26b
Falls into the age-old trap of attempting to retrieve an item from realm without first ensuring that realm is in an up-to-date state. Consider this scenario: - Editor is entered from main menu, causing it to create a new beatmap from its async `load()` method. - Editor opens correctly, then main thread performs a file operations on the same beatmap. - Main thread is potentially not refreshed yet, and will result in `null` instance when performing the re-fetch in `performFileOperation`. I've fixed this by using the safe implementation inside `RealmLive<T>`. Feels like we want this is one place which is always used as the correct method. On a quick search, there are 10-20 other usages of `Realm.Find<T>` which could also have similar issues, but it'll be a bit of a pain to go through and fix each of these. In 99.9% of cases, the accesses are on instances which couldn't have just been created (or the usage of recently-imported/created is blocked by realm subscription flows, ie. baetmap import) so I'm not touching them for now. Something to keep in mind when working with realm going forward though. |
||
---|---|---|
.. | ||
BeatmapExporter.cs | ||
BeatmapLookupCache.cs | ||
EmptyRealmSet.cs | ||
ICanAcceptFiles.cs | ||
IHasFiles.cs | ||
IHasGuidPrimaryKey.cs | ||
IHasNamedFiles.cs | ||
IHasOnlineID.cs | ||
IHasPrimaryKey.cs | ||
IHasRealmFiles.cs | ||
IModelDownloader.cs | ||
IModelFileManager.cs | ||
IModelImporter.cs | ||
IModelManager.cs | ||
ImportParameters.cs | ||
ImportProgressNotification.cs | ||
ImportTask.cs | ||
INamedFile.cs | ||
INamedFileInfo.cs | ||
INamedFileUsage.cs | ||
IPostNotifications.cs | ||
ISoftDelete.cs | ||
LegacyArchiveExporter.cs | ||
LegacyBeatmapExporter.cs | ||
LegacyBeatmapImporter.cs | ||
LegacyCollectionImporter.cs | ||
LegacyExporter.cs | ||
LegacyImportManager.cs | ||
LegacyModelImporter.cs | ||
LegacyScoreExporter.cs | ||
LegacyScoreImporter.cs | ||
LegacySkinExporter.cs | ||
LegacySkinImporter.cs | ||
Live.cs | ||
MemoryCachingComponent.cs | ||
ModelDownloader.cs | ||
ModelManager.cs | ||
OnlineLookupCache.cs | ||
RealmAccess.cs | ||
RealmArchiveModelImporter.cs | ||
RealmExtensions.cs | ||
RealmFileStore.cs | ||
RealmLive.cs | ||
RealmLiveUnmanaged.cs | ||
RealmObjectExtensions.cs | ||
StandardisedScoreMigrationTools.cs | ||
TooManyDownloadsNotification.cs | ||
UserLookupCache.cs |