diff --git a/LLama/LLamaContext.cs b/LLama/LLamaContext.cs index 33c8d726..6d39a8f9 100644 --- a/LLama/LLamaContext.cs +++ b/LLama/LLamaContext.cs @@ -443,7 +443,7 @@ namespace LLama : SafeLLamaHandleBase { internal State(IntPtr memory) - : base(memory) + : base(memory, true) { } diff --git a/LLama/Native/SafeLLamaGrammarHandle.cs b/LLama/Native/SafeLLamaGrammarHandle.cs index 6277e594..962d0643 100644 --- a/LLama/Native/SafeLLamaGrammarHandle.cs +++ b/LLama/Native/SafeLLamaGrammarHandle.cs @@ -21,7 +21,7 @@ namespace LLama.Native /// /// internal SafeLLamaGrammarHandle(IntPtr handle) - : base(handle) + : base(handle, true) { } diff --git a/LLama/Native/SafeLLamaHandleBase.cs b/LLama/Native/SafeLLamaHandleBase.cs index 7171c803..7dcc4ef9 100644 --- a/LLama/Native/SafeLLamaHandleBase.cs +++ b/LLama/Native/SafeLLamaHandleBase.cs @@ -14,12 +14,6 @@ namespace LLama.Native { } - private protected SafeLLamaHandleBase(IntPtr handle) - : base(IntPtr.Zero, ownsHandle: true) - { - SetHandle(handle); - } - private protected SafeLLamaHandleBase(IntPtr handle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) { @@ -30,7 +24,6 @@ namespace LLama.Native public override bool IsInvalid => handle == IntPtr.Zero; /// - public override string ToString() - => $"0x{handle:x16}"; + public override string ToString() => handle.ToString(); } }