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:
authornulltoken <emeric.fermas@gmail.com>2012-04-15 23:39:43 +0400
committernulltoken <emeric.fermas@gmail.com>2012-04-24 12:51:42 +0400
commit58a11459cf54041eec11e3f6cde2b815fd707aa8 (patch)
treea5cdb908d60c8af507debd828e4806ec96200e39
parent9444c7e40a9ef1fac18f71b7805e5e216f00839a (diff)
Reverse the order in which the native handles are being released
-rw-r--r--LibGit2Sharp/Repository.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs
index 41fdc6e9..e49e8c0d 100644
--- a/LibGit2Sharp/Repository.cs
+++ b/LibGit2Sharp/Repository.cs
@@ -23,7 +23,7 @@ namespace LibGit2Sharp
private readonly TagCollection tags;
private readonly Lazy<RepositoryInformation> info;
private readonly bool isBare;
- private readonly List<SafeHandleBase> handlesToCleanup = new List<SafeHandleBase>();
+ private readonly Stack<SafeHandleBase> handlesToCleanup = new Stack<SafeHandleBase>();
private static readonly Lazy<string> versionRetriever = new Lazy<string>(RetrieveVersion);
/// <summary>
@@ -177,7 +177,10 @@ namespace LibGit2Sharp
/// </summary>
protected virtual void Dispose(bool disposing)
{
- handlesToCleanup.ForEach(handleToCleanup => handleToCleanup.SafeDispose());
+ while (handlesToCleanup.Count > 0)
+ {
+ handlesToCleanup.Pop().SafeDispose();
+ }
}
#endregion
@@ -413,7 +416,7 @@ namespace LibGit2Sharp
internal void RegisterForCleanup(SafeHandleBase handleToCleanup)
{
- handlesToCleanup.Add(handleToCleanup);
+ handlesToCleanup.Push(handleToCleanup);
}
/// <summary>