diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-03-28 16:38:27 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-03-28 18:47:33 +0400 |
commit | c1a5d24bc9f0a2506ec249e2decf7331ca65ce7f (patch) | |
tree | 5d6f1a8dbcb059f6f6282f139c2794e3c4b314df /LibGit2Sharp | |
parent | 882ce61dc0b39ac9bf2303923fb90f4f6158753c (diff) |
Add TreeEntrySafeHandle type
Diffstat (limited to 'LibGit2Sharp')
-rw-r--r-- | LibGit2Sharp/Core/Handles/NotOwnedSafeHandleBase.cs | 24 | ||||
-rw-r--r-- | LibGit2Sharp/Core/Handles/TreeEntrySafeHandle.cs | 6 | ||||
-rw-r--r-- | LibGit2Sharp/LibGit2Sharp.csproj | 2 |
3 files changed, 32 insertions, 0 deletions
diff --git a/LibGit2Sharp/Core/Handles/NotOwnedSafeHandleBase.cs b/LibGit2Sharp/Core/Handles/NotOwnedSafeHandleBase.cs new file mode 100644 index 00000000..ef34b387 --- /dev/null +++ b/LibGit2Sharp/Core/Handles/NotOwnedSafeHandleBase.cs @@ -0,0 +1,24 @@ +using System; +using System.Runtime.InteropServices; + +namespace LibGit2Sharp.Core.Handles +{ + internal abstract class NotOwnedSafeHandleBase : SafeHandle + { + protected NotOwnedSafeHandleBase() + : base(IntPtr.Zero, false) + { + } + + public override bool IsInvalid + { + get { return (handle == IntPtr.Zero); } + } + + protected override bool ReleaseHandle() + { + // Does nothing as the pointer is owned by libgit2 + return true; + } + } +} diff --git a/LibGit2Sharp/Core/Handles/TreeEntrySafeHandle.cs b/LibGit2Sharp/Core/Handles/TreeEntrySafeHandle.cs new file mode 100644 index 00000000..f621cb2f --- /dev/null +++ b/LibGit2Sharp/Core/Handles/TreeEntrySafeHandle.cs @@ -0,0 +1,6 @@ +namespace LibGit2Sharp.Core.Handles +{ + internal class TreeEntrySafeHandle : NotOwnedSafeHandleBase + { + } +} diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index d50dfd47..4fbda390 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -60,8 +60,10 @@ <Compile Include="Core\EnumExtensions.cs" /> <Compile Include="Core\GitObjectExtensions.cs" /> <Compile Include="Core\Handles\GitObjectSafeHandle.cs" /> + <Compile Include="Core\Handles\NotOwnedSafeHandleBase.cs" /> <Compile Include="Core\ReferenceExtensions.cs" /> <Compile Include="Core\SignatureSafeHandle.cs" /> + <Compile Include="Core\Handles\TreeEntrySafeHandle.cs" /> <Compile Include="DetachedHead.cs" /> <Compile Include="LibGit2Exception.cs" /> <Compile Include="Core\ConfigurationSafeHandle.cs" /> |