From 9f5a280bc22b1f88d20b7b885d4aa252f7feee7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 31 Oct 2023 12:25:08 +0100 Subject: [PATCH] Fix key binding row fire-and-forgetting writes Intends to fix test failures as seen in https://github.com/ppy/osu/actions/runs/6692350567/job/18181352642#step:5:129 This is what happens if you carelessly fire and forget. The working theory (that I'm not sure I have the tools to conclusively confirm) is that the async write from the key binding changing could fire _after_ the section is reset. I briefly considered having the test wait for the change, but given that the entirety of the surrounding flow is using sync operations, this just looks like a bug to me. And there's no real sane way to inject async into that flow due to dependence on `OsuButton.Action`. --- osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs index c85fe4727a..e82cebe9f4 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs @@ -498,7 +498,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input if (existingBinding == null) { - realm.WriteAsync(r => r.Find(keyBinding.ID)!.KeyCombinationString = keyBinding.KeyCombination.ToString()); + realm.Write(r => r.Find(keyBinding.ID)!.KeyCombinationString = keyBinding.KeyCombination.ToString()); BindingUpdated?.Invoke(this, new KeyBindingUpdatedEventArgs(bindingConflictResolved: false, advanceToNextBinding)); return; }