wrapped the entire plugin draw pass in a single theme scope, prevent leaks to dalamud ui

This commit is contained in:
azyges
2025-10-12 21:48:51 +09:00
parent e6735be594
commit c0b8e15380
2 changed files with 12 additions and 16 deletions

View File

@@ -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);

View File

@@ -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();
}
}
}