Remove finalizer; cannot be finalized due to the use of GCHandle

This commit is contained in:
Soreepeong 2023-12-08 23:45:07 +09:00
parent 683464ed2d
commit a0b7f53b01

View file

@ -59,23 +59,12 @@ internal sealed unsafe class ImGuiClipboardConfig : IServiceType, IDisposable
((ImGuiClipboardConfig)GCHandle.FromIntPtr(userData).Target)!.GetClipboardTextImpl();
}
/// <summary>
/// Finalizes an instance of the <see cref="ImGuiClipboardConfig"/> class.
/// </summary>
~ImGuiClipboardConfig() => this.ReleaseUnmanagedResources();
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute", Justification = "If it's null, it's crashworthy")]
private static ImVectorWrapper<byte> ImGuiCurrentContextClipboardHandlerData =>
new((ImVector*)(ImGui.GetCurrentContext() + 0x5520));
/// <inheritdoc/>
public void Dispose()
{
this.ReleaseUnmanagedResources();
GC.SuppressFinalize(this);
}
private void ReleaseUnmanagedResources()
{
if (!this.clipboardUserData.IsAllocated)
return;