From c0b8e15380d5c1a5d4bb28d072d86d3137437402 Mon Sep 17 00:00:00 2001 From: azyges <229218900+azyges@users.noreply.github.com> Date: Sun, 12 Oct 2025 21:48:51 +0900 Subject: [PATCH] wrapped the entire plugin draw pass in a single theme scope, prevent leaks to dalamud ui --- .../Mediator/WindowMediatorSubscriberBase.cs | 15 +-------------- LightlessSync/Services/UiService.cs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/LightlessSync/Services/Mediator/WindowMediatorSubscriberBase.cs b/LightlessSync/Services/Mediator/WindowMediatorSubscriberBase.cs index 8d7aceb..3cecf83 100644 --- a/LightlessSync/Services/Mediator/WindowMediatorSubscriberBase.cs +++ b/LightlessSync/Services/Mediator/WindowMediatorSubscriberBase.cs @@ -1,5 +1,4 @@ -using Dalamud.Interface.Windowing; -using LightlessSync.UI.Style; +using Dalamud.Interface.Windowing; using Microsoft.Extensions.Logging; namespace LightlessSync.Services.Mediator; @@ -34,18 +33,6 @@ public abstract class WindowMediatorSubscriberBase : Window, IMediatorSubscriber GC.SuppressFinalize(this); } - public override void PreDraw() - { - base.PreDraw(); - MainStyle.PushStyle(); // internally checks ShouldUseTheme - } - - public override void PostDraw() - { - MainStyle.PopStyle(); // always attempts to pop if pushed - base.PostDraw(); - } - public override void Draw() { _performanceCollectorService.LogPerformance(this, $"Draw", DrawInternal); diff --git a/LightlessSync/Services/UiService.cs b/LightlessSync/Services/UiService.cs index bb69301..3740114 100644 --- a/LightlessSync/Services/UiService.cs +++ b/LightlessSync/Services/UiService.cs @@ -4,6 +4,7 @@ using Dalamud.Interface.Windowing; using LightlessSync.LightlessConfiguration; using LightlessSync.Services.Mediator; using LightlessSync.UI; +using LightlessSync.UI.Style; using Microsoft.Extensions.Logging; namespace LightlessSync.Services; @@ -120,7 +121,15 @@ public sealed class UiService : DisposableMediatorSubscriberBase private void Draw() { - _windowSystem.Draw(); - _fileDialogManager.Draw(); + MainStyle.PushStyle(); + try + { + _windowSystem.Draw(); + _fileDialogManager.Draw(); + } + finally + { + MainStyle.PopStyle(); + } } } \ No newline at end of file