r24110 by jghali - #16282: Spellcheck crash issue
scribus-commit
scribus-commit at lists.scribus.net
Mon Oct 26 21:04:40 UTC 2020
Author: jghali
Date: Mon Oct 26 21:04:40 2020
New Revision: 24110
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24110
Log:
#16282: Spellcheck crash issue
Modified:
branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
Modified: branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24110&path=/branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp Mon Oct 26 21:04:40 2020
@@ -123,12 +123,13 @@
void HunspellDialog::changeAllWords()
{
- if(m_wfList->at(wfListIndex).ignore && !m_wfList->at(wfListIndex).changed)
- return;
- QString wordToChange=m_wfList->at(wfListIndex).w;
+ if (m_wfList->at(wfListIndex).ignore && !m_wfList->at(wfListIndex).changed)
+ return;
+
+ QString wordToChange = m_wfList->at(wfListIndex).w;
//Do we start from 0 or from the instance of the word where we are... 0 for now
- for(int i=0;i<m_wfList->count();++i)
- if(m_wfList->at(i).w==wordToChange)
+ for (int i = 0; i < m_wfList->count(); ++i)
+ if (m_wfList->at(i).w == wordToChange)
replaceWord(i);
goToNextWord();
}
@@ -136,15 +137,19 @@
void HunspellDialog::replaceWord(int i)
{
//TODO: rehypenate after the replacement
- QString newText(suggestionsListWidget->currentItem()->text());
- int lengthDiff=m_iText->replaceWord(m_wfList->at(i).start+m_wfList->at(i).changeOffset, newText);
- if (lengthDiff!=0)
- {
- for (int k=i; k<m_wfList->count();++k)
- (*m_wfList)[k].changeOffset+=lengthDiff;
- }
- (*m_wfList)[i].changed=true;
- m_docChanged=true;
+ QListWidgetItem* suggestionItem = suggestionsListWidget->currentItem();
+ if (!suggestionItem)
+ return;
+
+ QString newText(suggestionItem->text());
+ int lengthDiff = m_iText->replaceWord(m_wfList->at(i).start + m_wfList->at(i).changeOffset, newText);
+ if (lengthDiff != 0)
+ {
+ for (int k = i; k < m_wfList->count(); ++k)
+ (*m_wfList)[k].changeOffset += lengthDiff;
+ }
+ (*m_wfList)[i].changed = true;
+ m_docChanged = true;
}
void HunspellDialog::languageComboChanged(const QString &newLanguage)
More information about the scribus-commit
mailing list