[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/lib/kotext
From:       David Faure <faure () kde ! org>
Date:       2006-02-16 10:51:01
Message-ID: 1140087061.328178.15530.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 510085 by dfaure:

Don't use d->parag when iterator has reached the end, it might be dangling \
                (->crash).
Testcase: kword kdelibs/kioslave/http/rfc2818.txt, Ctrl-A, Ctrl-X (while \
bgspellcheck is happening).


 M  +10 -5     KoSpell.cpp  


--- trunk/koffice/lib/kotext/KoSpell.cpp #510084:510085
@@ -127,6 +127,7 @@
     kdDebug()<<"getMoreText: dialog = " << d->dialog << ", itr = "
              << d->itr << ", atEnd = "
              << ( ( d->itr ) ? d->itr->atEnd() : true )
+             << " d->parag=" << d->parag
              << endl;
 #endif
 
@@ -136,18 +137,16 @@
             d->lastTxtDocument = \
d->itr->currentTextObject()->textDocument();  }
 
-    bool iteratorAtEnd = d->itr && d->itr->atEnd();
+    if ( d->itr && d->itr->atEnd() )
+        return QString::null;
 
-    if ( !d->dialog && ( !d->itr || iteratorAtEnd ) ) {
+    if ( !d->dialog && !d->itr ) {
         QString str = d->parag ? d->parag->string()->stringToSpellCheck() \
: QString::null;  if ( !str.isEmpty() )
             emit aboutToFeedText();
         return str;
     }
 
-    if ( iteratorAtEnd )
-        return QString::null;
-
     d->needsIncrement = true;
 
     QString text = d->itr->currentText();
@@ -200,10 +199,16 @@
 
 void KoSpell::slotCurrentParagraphDeleted()
 {
+#ifdef DEBUG_SPELL
+    kdDebug() << "KoSpell::slotCurrentParagraphDeleted itr=" << d->itr << \
endl; +#endif
     stop();
     if ( d->itr ) {
         d->needsIncrement = false;
         d->parag = d->itr->currentParag();
+#ifdef DEBUG_SPELL
+        kdDebug() << "KoSpell::slotCurrentParagraphDeleted d->parag=" << \
d->parag << endl; +#endif
         start();
     } else {
         d->parag = 0;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic