diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index a9ab5e1d5..e60bcbb7e 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -1367,12 +1367,15 @@ public static IntPtr git_odb_backend_malloc(IntPtr backend, UIntPtr len) public static bool git_odb_exists(ObjectDatabaseSafeHandle odb, ObjectId id) { - GitOid oid = id.Oid; + using (ThreadAffinity()) + { + GitOid oid = id.Oid; - int res = NativeMethods.git_odb_exists(odb, ref oid); - Ensure.BooleanResult(res); + int res = NativeMethods.git_odb_exists(odb, ref oid); + Ensure.BooleanResult(res); - return (res == 1); + return (res == 1); + } } public static ICollection git_odb_foreach(