Patch for kbabel (fixes crash)

Ben Burton bab at debian.org
Thu Mar 24 23:03:44 GMT 2005


Hi.

In KDE 3.3.x it seems that kbabel can crash without warning if
on-the-fly spellchecking is enabled and there are many spelling errors
in a particular entry.  See http://bugs.debian.org/289646 for details.
I can reproduce this also, though sometimes I have to try a few times.

It seems that the kbabel crash can be prevented by using
KSpell::checkWord() instead of KSpell::check():

--- kdesdk-3.3.2.orig/kbabel/kbabel/kbhighlighting.cpp
+++ kdesdk-3.3.2/kbabel/kbabel/kbhighlighting.cpp
@@ -226,8 +226,7 @@
     // there is no 'spelt correctly' signal so default to Okay
     kdDebug(KBABEL) << "Adding word " << word << endl;
     dict.replace(word, Okay);
-    // yes I tried checkWord, the docs lie and it didn't give useful signals :-
(
-    mSpell->check(word, false);
+    mSpell->checkWord(word, false);
     return false;
 }

Currently KSpell::check() is only used for checking a single word
anyway, so theoretically the patch above should not hurt.  There is a
comment in the code (as seen above) that checkWord() was not emitting
the correct signals, which is why the more heavy-duty check() was used.
This comment is two years old (kbhighlighting 1.6, April 2003), and I
believe it is no longer applicable.

I've made the patch in the debian sources.  Spellchecking on the fly
still works (which means the misspelled() signal is being emitted as
expected), and the crash has gone away.

Is it okay to commit this?  I would like the patch in 3_3_BRANCH also if
possible, since that's what we're currently shipping in debian.

Ben.





More information about the kde-core-devel mailing list