diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 22e1b5ebf..45f712583 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -5836,6 +5836,7 @@ namespace Nikse.SubtitleEdit.Forms if (result == DialogResult.No) { + _spellCheckForm.Dispose(); _spellCheckForm = new SpellCheck(); _spellCheckForm.DoSpellCheck(autoDetect, _subtitle, dictionaryFolder, this, startFromLine); } diff --git a/src/Forms/SpellCheck.Designer.cs b/src/Forms/SpellCheck.Designer.cs index 97767dfe3..3e1dd8651 100644 --- a/src/Forms/SpellCheck.Designer.cs +++ b/src/Forms/SpellCheck.Designer.cs @@ -5,20 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - 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 diff --git a/src/Forms/SpellCheck.cs b/src/Forms/SpellCheck.cs index 8f524fe30..94ce491b5 100644 --- a/src/Forms/SpellCheck.cs +++ b/src/Forms/SpellCheck.cs @@ -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(); } + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + if (_hunspell != null) + { + _hunspell.Dispose(); + _hunspell = null; + } + components.Dispose(); + } + base.Dispose(disposing); + } + } }