aboutsummaryrefslogtreecommitdiff
path: root/lib/Utils/src/Native
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-04-23 11:28:48 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-04-23 11:28:48 -0400
commit311f8cbb0ffe623134896c696b71339fb1ab3954 (patch)
treeff9bf969e5fd194ba0230ef0403b3f7a5b3985a8 /lib/Utils/src/Native
parentd65aa4f010adbd6c8162eb08c5787550e27d3e47 (diff)
Rest cleint construction
Diffstat (limited to 'lib/Utils/src/Native')
-rw-r--r--lib/Utils/src/Native/SafeMethodHandle.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Utils/src/Native/SafeMethodHandle.cs b/lib/Utils/src/Native/SafeMethodHandle.cs
index 3ba0879..478b505 100644
--- a/lib/Utils/src/Native/SafeMethodHandle.cs
+++ b/lib/Utils/src/Native/SafeMethodHandle.cs
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2022 Vaughn Nugent
+* Copyright (c) 2023 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Utils
@@ -57,5 +57,17 @@ namespace VNLib.Utils.Native
//Decrement lib handle count
Library.DangerousRelease();
}
+
+ /// <summary>
+ /// Releases the library handle on finalization
+ /// </summary>
+#pragma warning disable CA1063 // Implement IDisposable Correctly
+ ~SafeMethodHandle()
+ {
+ //Make sure the library is released on finalization
+ Library.DangerousRelease();
+ }
+#pragma warning restore CA1063 // Implement IDisposable Correctly
+
}
}