summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SwifTools/HunspellChecker.cpp2
-rw-r--r--Swift/QtUI/QtTextEdit.cpp8
2 files changed, 3 insertions, 7 deletions
diff --git a/SwifTools/HunspellChecker.cpp b/SwifTools/HunspellChecker.cpp
index ecd352e..e9bc558 100644
--- a/SwifTools/HunspellChecker.cpp
+++ b/SwifTools/HunspellChecker.cpp
@@ -26,7 +26,7 @@ bool HunspellChecker::isCorrect(const std::string& word) {
}
void HunspellChecker::getSuggestions(const std::string& word, std::vector<std::string>& list) {
- char **suggestList;
+ char **suggestList = NULL;
int words_returned;
if (!word.empty()) {
words_returned = speller_->suggest(&suggestList, word.c_str());
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index cac8bb4..8551f3d 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -202,16 +202,12 @@ void QtTextEdit::addSuggestions(QMenu* menu, QContextMenuEvent* event)
#ifdef HAVE_SPELLCHECKER
void QtTextEdit::setUpSpellChecker()
{
- SpellCheckerFactory* checkerFactory = new SpellCheckerFactory();
delete checker_;
+ checker_ = NULL;
if (settings_->getSetting(SettingConstants::SPELL_CHECKER)) {
std::string dictPath = settings_->getSetting(SettingConstants::DICT_PATH);
std::string dictFile = settings_->getSetting(SettingConstants::DICT_FILE);
- checker_ = checkerFactory->createSpellChecker(dictPath + dictFile);
- delete checkerFactory;
- }
- else {
- checker_ = NULL;
+ checker_ = SpellCheckerFactory().createSpellChecker(dictPath + dictFile);
}
}
#endif