[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 44227] Background Spellcheck Page update and general spellcheck problem
From: David Faure <faure () kde ! org>
Date: 2003-03-31 21:54:33
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=44227
------- Additional Comments From faure@kde.org 2003-03-31 23:54 -------
Subject: koffice/lib/kotext
CVS commit by faure:
Fixed race condition that led to some words not being spellchecked.
CCMAIL: 44227@bugs.kde.org
M +14 -5 koBgSpellCheck.cc 1.35
--- koffice/lib/kotext/koBgSpellCheck.cc #1.34:1.35
@@ -230,4 +230,7 @@ void KoBgSpellCheck::nextParagraphNeedin
if ( parag && parag->string() && parag->string()->needsSpellCheck() )
{
+#ifdef DEBUG_BGSPELLCHECKING
+ kdDebug(32500) << "current parag " << parag << " needs checking again." \
<<endl; +#endif
return;
}
@@ -261,6 +264,4 @@ void KoBgSpellCheck::nextParagraphNeedin
else
{
- if ( m_bgSpell.currentParag )
- m_bgSpell.currentParag->string()->setNeedsSpellCheck( false );
if ( m_bgSpell.currentTextObj )
m_bgSpell.currentTextObj->setNeedSpellCheck( false );
@@ -301,7 +302,16 @@ void KoBgSpellCheck::spellCheckNextParag
kdDebug(32500) << "KoBgSpellCheck::spellCheckNextParagraph spell checking parag \
" << m_bgSpell.currentParag->paragId() << endl; #endif
- // Now spell-check that paragraph
+
+ // Get the text to spell-check
QString text = m_bgSpell.currentParag->string()->toString();
text.remove( text.length() - 1, 1 ); // trailing space
+
+ // Mark it as "we've read the text to be spell-checked", *before* doing it.
+ // This prevents race conditions: if the user modifies the text during
+ // the spellchecking, the new text _will_ be checked, since the bool will
+ // be set to true.
+ m_bgSpell.currentParag->string()->setNeedsSpellCheck( false );
+
+ // Now spell-check that paragraph
m_bgSpell.kspell->check(text);
}
@@ -335,7 +345,6 @@ void KoBgSpellCheck::spellCheckerDone()
kdDebug(32500) << "KoBgSpellCheck::spellCheckerDone" << endl;
#endif
- if(m_bgSpell.currentParag)
- m_bgSpell.currentParag->string()->setNeedsSpellCheck( false );
if( m_bgSpell.currentTextObj && \
m_bgSpell.currentParag==m_bgSpell.currentTextObj->textDocument()->lastParag()) + \
// ### and there is no paragraph in the textobject that got the "needsSpellCheck" \
flag since! m_bgSpell.currentTextObj->setNeedSpellCheck(false);
// Done checking the current paragraph, schedule the next one
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic