mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Merge pull request #2501 from Haselnussbomber/clear-ImDrawListSplitter
Clear ImDrawListSplitter when disposing SeStringDrawState
This commit is contained in:
commit
71b0a757e9
2 changed files with 6 additions and 2 deletions
|
|
@ -170,7 +170,7 @@ internal class SeStringRenderer : IServiceType
|
|||
|
||||
// This also does argument validation for drawParams. Do it here.
|
||||
// `using var` makes a struct read-only, but we do want to modify it.
|
||||
var stateStorage = new SeStringDrawState(
|
||||
using var stateStorage = new SeStringDrawState(
|
||||
sss,
|
||||
drawParams,
|
||||
ThreadSafety.IsMainThread ? this.colorStackSetMainThread : new(this.colorStackSetMainThread.ColorTypes),
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Dalamud.Interface.Utility;
|
|||
using Dalamud.Utility;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
||||
using Lumina.Text.Payloads;
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ namespace Dalamud.Interface.ImGuiSeStringRenderer;
|
|||
|
||||
/// <summary>Calculated values from <see cref="SeStringDrawParams"/> using ImGui styles.</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe ref struct SeStringDrawState
|
||||
public unsafe ref struct SeStringDrawState : IDisposable
|
||||
{
|
||||
private static readonly int ChannelCount = Enum.GetValues<SeStringDrawChannel>().Length;
|
||||
|
||||
|
|
@ -194,6 +195,9 @@ public unsafe ref struct SeStringDrawState
|
|||
/// <summary>Gets the text fragments.</summary>
|
||||
internal List<TextFragment> Fragments { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose() => this.splitter.ClearFreeMemory();
|
||||
|
||||
/// <summary>Sets the current channel in the ImGui draw list splitter.</summary>
|
||||
/// <param name="channelIndex">Channel to switch to.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue