Fixed a few minor hunspell leaks

This commit is contained in:
niksedk 2014-10-04 13:18:55 +02:00
parent c6a4d4bc7f
commit 17f400be35
3 changed files with 22 additions and 14 deletions

View File

@ -5836,6 +5836,7 @@ namespace Nikse.SubtitleEdit.Forms
if (result == DialogResult.No) if (result == DialogResult.No)
{ {
_spellCheckForm.Dispose();
_spellCheckForm = new SpellCheck(); _spellCheckForm = new SpellCheck();
_spellCheckForm.DoSpellCheck(autoDetect, _subtitle, dictionaryFolder, this, startFromLine); _spellCheckForm.DoSpellCheck(autoDetect, _subtitle, dictionaryFolder, this, startFromLine);
} }

View File

@ -7,19 +7,6 @@
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>

View File

@ -320,6 +320,8 @@ namespace Nikse.SubtitleEdit.Forms
private void LoadHunspell(string dictionary) private void LoadHunspell(string dictionary)
{ {
_currentDictionary = dictionary; _currentDictionary = dictionary;
if (_hunspell != null)
_hunspell.Dispose();
_hunspell = Hunspell.GetHunspell(dictionary); _hunspell = Hunspell.GetHunspell(dictionary);
} }
@ -1292,5 +1294,23 @@ namespace Nikse.SubtitleEdit.Forms
PrepareNextWord(); PrepareNextWord();
} }
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
if (_hunspell != null)
{
_hunspell.Dispose();
_hunspell = null;
}
components.Dispose();
}
base.Dispose(disposing);
}
} }
} }