From 182454032526775db3f92fb71cf474cbcb40370d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 11:15:21 +0900 Subject: [PATCH 1/2] Schedule calls to correct thread These could be fired from an async worker thread (for instance, maintenance operations). --- osu.Game/Screens/Select/SongSelect.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 5500d06136..24a7b3db90 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -203,8 +203,8 @@ namespace osu.Game.Screens.Select Push(new Editor()); } - private void onBeatmapRestored(BeatmapInfo b) => carousel.UpdateBeatmap(b); - private void onBeatmapHidden(BeatmapInfo b) => carousel.UpdateBeatmap(b); + private void onBeatmapRestored(BeatmapInfo b) => Schedule(() => carousel.UpdateBeatmap(b)); + private void onBeatmapHidden(BeatmapInfo b) => Schedule(() => carousel.UpdateBeatmap(b)); private void carouselBeatmapsLoaded() { From 85827f83eb6d54ea119260e120013f02e9904af2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 17:03:56 +0900 Subject: [PATCH 2/2] Perform a reload on objects when Refreshing them Previously, it was possible for an object to be "refreshed" with a stale cached state from the current thread's context. This ensures a check against the database is performed as well. Resolves #1562. --- osu.Game/Database/DatabaseBackedStore.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index bc1b7132eb..d8c3ce6694 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -35,6 +35,7 @@ namespace osu.Game.Database var id = obj.ID; obj = lookupSource?.SingleOrDefault(t => t.ID == id) ?? context.Find(id); + context.Entry(obj).Reload(); } ///