You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2011/09/19 07:32:29 UTC
[Lucene.Net] svn commit: r1172436 -
/incubator/lucene.net/trunk/src/contrib/SpellChecker/Spell/SpellChecker.cs
Author: mherndon
Date: Mon Sep 19 05:32:28 2011
New Revision: 1172436
URL: http://svn.apache.org/viewvc?rev=1172436&view=rev
Log:
LUCENENET-443 removing close from finalizer. Giving into DIGY's peer pressure and implemented IDisposable for spellchecker. Dispose needs to be called directly to release managed resources.
Modified:
incubator/lucene.net/trunk/src/contrib/SpellChecker/Spell/SpellChecker.cs
Modified: incubator/lucene.net/trunk/src/contrib/SpellChecker/Spell/SpellChecker.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/contrib/SpellChecker/Spell/SpellChecker.cs?rev=1172436&r1=1172435&r2=1172436&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/contrib/SpellChecker/Spell/SpellChecker.cs (original)
+++ incubator/lucene.net/trunk/src/contrib/SpellChecker/Spell/SpellChecker.cs Mon Sep 19 05:32:28 2011
@@ -57,7 +57,7 @@ namespace SpellChecker.Net.Search.Spell
/// </author>
/// <version> 1.0
/// </version>
- public class SpellChecker
+ public class SpellChecker : IDisposable
{
/// <summary> Field name for each word in the ngram index.</summary>
public const System.String F_WORD = "word";
@@ -589,7 +589,22 @@ namespace SpellChecker.Net.Search.Spell
~SpellChecker()
{
- this.Close();
+ this.Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected void Dispose(bool disposeOfManagedResources)
+ {
+ if (disposeOfManagedResources)
+ {
+ if (!this.closed)
+ this.Close();
+ }
}
}
}
\ No newline at end of file