Fix freezing popouts on saving the settings
This commit is contained in:
@@ -1157,7 +1157,7 @@ public sealed class ChatLogWindow : Window
|
||||
}
|
||||
|
||||
internal readonly List<bool> PopOutDocked = [];
|
||||
internal readonly Dictionary<string, Window> PopOutWindows = new();
|
||||
internal readonly HashSet<Guid> PopOutWindows = [];
|
||||
private void AddPopOutsToDraw()
|
||||
{
|
||||
HandlerLender.ResetCounter();
|
||||
@@ -1174,13 +1174,13 @@ public sealed class ChatLogWindow : Window
|
||||
if (!tab.PopOut)
|
||||
continue;
|
||||
|
||||
if (PopOutWindows.ContainsKey($"{tab.Name}{i}"))
|
||||
if (PopOutWindows.Contains(tab.Identifier))
|
||||
continue;
|
||||
|
||||
var window = new Popout(this, tab, i);
|
||||
|
||||
Plugin.WindowSystem.AddWindow(window);
|
||||
PopOutWindows.Add($"{tab.Name}{i}", window);
|
||||
PopOutWindows.Add(tab.Identifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -26,6 +26,12 @@ internal class Popout : Window
|
||||
DisableWindowSounds = true;
|
||||
}
|
||||
|
||||
public override void PreOpenCheck()
|
||||
{
|
||||
if (!Tab.PopOut)
|
||||
IsOpen = false;
|
||||
}
|
||||
|
||||
public override bool DrawConditions()
|
||||
{
|
||||
return !ChatLogWindow.IsHidden;
|
||||
@@ -48,9 +54,10 @@ internal class Popout : Window
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
using var id = ImRaii.PushId($"popout-{Tab.Name}");
|
||||
using var id = ImRaii.PushId($"popout-{Tab.Identifier}");
|
||||
|
||||
if (!ChatLogWindow.Plugin.Config.ShowPopOutTitleBar) {
|
||||
if (!ChatLogWindow.Plugin.Config.ShowPopOutTitleBar)
|
||||
{
|
||||
ImGui.TextUnformatted(Tab.Name);
|
||||
ImGui.Separator();
|
||||
}
|
||||
@@ -69,7 +76,7 @@ internal class Popout : Window
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
ChatLogWindow.PopOutWindows.Remove($"{Tab.Name}{Idx}");
|
||||
ChatLogWindow.PopOutWindows.Remove(Tab.Identifier);
|
||||
ChatLogWindow.Plugin.WindowSystem.RemoveWindow(this);
|
||||
|
||||
Tab.PopOut = false;
|
||||
|
||||
@@ -65,7 +65,7 @@ public sealed class SettingsWindow : Window
|
||||
|
||||
private void Initialise()
|
||||
{
|
||||
Mutable.UpdateFrom(Plugin.Config);
|
||||
Mutable.UpdateFrom(Plugin.Config, false);
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
@@ -153,7 +153,7 @@ public sealed class SettingsWindow : Window
|
||||
|| Math.Abs(Mutable.JapaneseFontSize - Plugin.Config.JapaneseFontSize) > 0.001
|
||||
|| Math.Abs(Mutable.SymbolsFontSize - Plugin.Config.SymbolsFontSize) > 0.001;
|
||||
|
||||
Plugin.Config.UpdateFrom(Mutable);
|
||||
Plugin.Config.UpdateFrom(Mutable, true);
|
||||
|
||||
// save after 60 frames have passed, which should hopefully not
|
||||
// commit any changes that cause a crash
|
||||
|
||||
Reference in New Issue
Block a user