Fix memory ownership on AddFontFromImGuiHeapAllocatedMemory (#1651)

This commit is contained in:
srkizer 2024-02-15 07:52:40 +09:00 committed by GitHub
parent 34ed07ef1f
commit ea43d65636
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View file

@ -46,6 +46,9 @@ internal sealed partial class FontAtlasFactory
private class FontAtlasBuiltData : IRefCountable
{
// Field for debugging.
private static int numActiveInstances;
private readonly List<IDalamudTextureWrap> wraps;
private readonly List<IFontHandleSubstance> substances;
@ -73,6 +76,9 @@ internal sealed partial class FontAtlasFactory
this.Garbage.Add(() => ImGuiNative.ImFontAtlas_destroy(atlasPtr));
this.IsBuildInProgress = true;
Interlocked.Increment(ref numActiveInstances);
this.Garbage.Add(() => Interlocked.Decrement(ref numActiveInstances));
}
catch
{