From 4d977d51181fe2fafcbd557213df7e7fa1146cb5 Mon Sep 17 00:00:00 2001 From: JonKazama-Hellion Date: Sat, 2 May 2026 21:20:49 +0200 Subject: [PATCH] fix(fonts): marshal font chooser results onto the framework thread Three FontChooser ContinueWith handlers wrote Mutable.* directly from the threadpool. Wrap the result-write in Plugin.Framework.Run so the mutation lands on the same thread that owns the rest of the UI state. Matches the marshalling pattern already used by Database.cs and Privacy.cs background work. --- ChatTwo/Ui/SettingsTabs/Appearance.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ChatTwo/Ui/SettingsTabs/Appearance.cs b/ChatTwo/Ui/SettingsTabs/Appearance.cs index e15e10b..a4bd4eb 100644 --- a/ChatTwo/Ui/SettingsTabs/Appearance.cs +++ b/ChatTwo/Ui/SettingsTabs/Appearance.cs @@ -147,7 +147,9 @@ internal sealed class Appearance : ISettingsTab globalChooser?.ResultTask.ContinueWith(r => { if (r.IsCompletedSuccessfully) - Mutable.GlobalFontV2 = r.Result; + { + Plugin.Framework.Run(() => Mutable.GlobalFontV2 = r.Result); + } }); ImGui.SameLine(); if (ImGui.Button("Reset##global")) @@ -164,7 +166,9 @@ internal sealed class Appearance : ISettingsTab japaneseChooser?.ResultTask.ContinueWith(r => { if (r.IsCompletedSuccessfully) - Mutable.JapaneseFontV2 = r.Result; + { + Plugin.Framework.Run(() => Mutable.JapaneseFontV2 = r.Result); + } }); ImGui.SameLine(); if (ImGui.Button("Reset##japanese")) @@ -179,7 +183,9 @@ internal sealed class Appearance : ISettingsTab italicChooser?.ResultTask.ContinueWith(r => { if (r.IsCompletedSuccessfully) - Mutable.ItalicFontV2 = r.Result; + { + Plugin.Framework.Run(() => Mutable.ItalicFontV2 = r.Result); + } }); ImGui.SameLine(); if (ImGui.Button("Reset##italic"))