Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ Wyman <jeremy.wyman@microsoft.com>2015-06-09 00:19:12 +0300
committerJ Wyman <jeremy.wyman@microsoft.com>2015-06-09 00:19:12 +0300
commit802aa50e167fd881943e0f92b905b2ffc173a41e (patch)
tree037674001be22689a04a07ec42cdd5ab393fce60
parent7202df7e971c1cbb32a7e26236064cde326a4e5a (diff)
Fixes a trio of concurrency issues found by Coverity
-rw-r--r--LibGit2Sharp/Core/Handles/SafeHandleBase.cs10
-rw-r--r--LibGit2Sharp/Core/LazyGroup.cs7
2 files changed, 13 insertions, 4 deletions
diff --git a/LibGit2Sharp/Core/Handles/SafeHandleBase.cs b/LibGit2Sharp/Core/Handles/SafeHandleBase.cs
index b4ad9804..e16e3091 100644
--- a/LibGit2Sharp/Core/Handles/SafeHandleBase.cs
+++ b/LibGit2Sharp/Core/Handles/SafeHandleBase.cs
@@ -66,7 +66,15 @@ namespace LibGit2Sharp.Core
/// </summary>
public static IEnumerable<string> TypeNames
{
- get { return _typeNames.ToArray(); }
+ get
+ {
+ string[] result = null;
+ lock (_lockpad)
+ {
+ result = _typeNames.ToArray();
+ }
+ return result;
+ }
}
}
}
diff --git a/LibGit2Sharp/Core/LazyGroup.cs b/LibGit2Sharp/Core/LazyGroup.cs
index 3c82fa3a..da6fed92 100644
--- a/LibGit2Sharp/Core/LazyGroup.cs
+++ b/LibGit2Sharp/Core/LazyGroup.cs
@@ -24,18 +24,19 @@ namespace LibGit2Sharp.Core
public void Evaluate()
{
- if (evaluated)
- return;
-
lock (@lock)
{
if (evaluated)
+ {
return;
+ }
EvaluateInternal(input =>
{
foreach (var e in evaluators)
+ {
e.Evaluate(input);
+ }
});
evaluated = true;
}