Permalink
Browse files

Remove useless GC.SuppressFinalize()

  • Loading branch information...
1 parent 7cd4c55 commit d03bcb995993867f9260f32786ca25d6071d563d @yorah yorah committed with nulltoken Feb 18, 2013
Showing with 0 additions and 2 deletions.
  1. +0 −1 LibGit2Sharp/Core/ObjectSafeWrapper.cs
  2. +0 −1 LibGit2Sharp/Repository.cs
View
1 LibGit2Sharp/Core/ObjectSafeWrapper.cs
@@ -30,7 +30,6 @@ public GitObjectSafeHandle ObjectPtr
public void Dispose()
{
Dispose(true);
- GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
View
1 LibGit2Sharp/Repository.cs
@@ -305,7 +305,6 @@ public NoteCollection Notes
public void Dispose()
{
Dispose(true);
- GC.SuppressFinalize(this);
}
/// <summary>

5 comments on commit d03bcb9

@sharwell

If the class implementing IDisposable is not sealed, then it should include the call to GC.SuppressFinalize(this) even if it does not include a user-defined finalizer. This is necessary to ensure proper semantics for derived types that add a user-defined finalizer but only override the protected Dispose(bool) method.

Neither of the two classes above are sealed, so neither of these calls should have been removed.

@sharwell

@nulltoken Thanks, I looked briefly for a reference but eventually just wrote that from memory 😄

@nulltoken
libgit2 member

@sharwell I'm going to revert this commit.

Thinking about this I think there are some other IDisposable types in the source code and I'm pretty sure not all of them call GC.SuppressFinalize. If you had some time to track them down, that would be awesome 😉

@yorah

Nice, thanks for catching this!

Please sign in to comment.