1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:47:28 +08:00
Commit Graph

11 Commits

Author SHA1 Message Date
Dean Herbert
6e11162ab1 Add helper method for safer realm Find<T> 2023-08-16 15:37:09 +09:00
Bartłomiej Dach
6c4c76350f
Remove unused using directive 2023-08-16 07:36:56 +02:00
Dean Herbert
531794b26b Fix ModelManager not correctly re-retrieving realm objects before performing operations
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.
2023-08-16 14:23:32 +09:00
Dean Herbert
a98a36872e Bring realm library up-to-date 2023-07-06 13:37:43 +09:00
Dean Herbert
811a562608 Don't use bindables to avoid potential cross-usage contamination 2023-01-10 01:10:20 +09:00
Dean Herbert
62ffb4fe78 Pause imports during active gameplay 2023-01-09 18:54:11 +09:00
Dean Herbert
ac99c1ad69 Migrate the majority of existing file lookups to use new extension methods 2022-08-10 16:01:16 +09:00
Dean Herbert
01487a1185 Add assertion on realm re-fetch being not-null 2022-06-27 15:52:45 +09:00
Bartłomiej Dach
26c5b59f6d
Replace usages of string.To{Lower,Upper}() 2022-06-24 11:57:45 +02:00
Dan Balasescu
f8830c6850 Automated #nullable processing 2022-06-17 16:37:17 +09:00
Dean Herbert
448eee051a Update filename to match new class name 2022-06-16 19:41:14 +09:00