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)
{
_spellCheckForm.Dispose();
_spellCheckForm = new SpellCheck();
_spellCheckForm.DoSpellCheck(autoDetect, _subtitle, dictionaryFolder, this, startFromLine);
}

View File

@ -5,20 +5,7 @@
/// <summary>
/// Required designer variable.
/// </summary>
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);
}
private System.ComponentModel.IContainer components = null;
#region Windows Form Designer generated code

View File

@ -320,6 +320,8 @@ namespace Nikse.SubtitleEdit.Forms
private void LoadHunspell(string dictionary)
{
_currentDictionary = dictionary;
if (_hunspell != null)
_hunspell.Dispose();
_hunspell = Hunspell.GetHunspell(dictionary);
}
@ -1292,5 +1294,23 @@ namespace Nikse.SubtitleEdit.Forms
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);
}
}
}