Version: KOffice CVS HEAD 2003-01-06 09:48 UTC (using KDE KDE 3.0.99) Installed from: Compiled From Sources Compiler: gcc 3.2 -march=pentium2 OS: Linux Just after loading the MSWrite test file (kofficetests/documents/import/mswrite/filtertest.wri), KWord crashes. As it worked before the cvs update of KWord, I do not think that it is a filter problem. Have a nice day/evening/night!
Created attachment 705 [details] Crash output
It is not only this file. I have the same problem when inserting a variable in KWord on a new document. Have a nice day/evening/night!
Created attachment 708 [details] Crash with KOffice 2003-01-06 16:47 UTC The crash has now changed a little.
Just a feeling: could it be when there is a <FORMAT> where the id attribute is not 1? Have a nice day/evening/night!
Subject: [PATCH] Fix KoText crash (#52661) Attached is a (rough) patch for koffice/lib/kotext/kotextformatter.cc It fixes KDE Bug#52661 (crash of KWord when loading the MSWrite test file kofficetests/documents/import/mswrite/filtertest.wri and similar crashes.) The problem is that the code assumed that KoTextStringChar::d.format is always valid, which it is not in the case of custom data (pictures, variables and anything similar, which in a KWord file have a <FORMAT> where id != 1) Having seen the code, I am also asking myself if instead of using the height of the characters to decide where to draw the underline, it would not be better to use only the descent. Otherwise, it might get ugly for fonts having an untypical ascent/descent ratio. (Similar for strikeout, where using the ascent would be better in my opinion.) Have a nice day/evening/night! Created an attachment (id=717) kotextformatter.diff
Subject: koffice/lib/kotext CVS commit by goutte: Fix the crash of KWord in KoText (If the change is not right, it can be still changed, but I have supposed that people would prefer a working KWord for the weekend.) CCMAIL: 52661-close@bugs.kde.org M +3 -3 kotextformatter.cc 1.50 --- koffice/lib/kotext/kotextformatter.cc #1.49:1.50 @@ -605,8 +605,8 @@ KoTextParagLineStart *KoTextFormatter::k } double current=0; - double nc=0; + int nc=0; // Not double, as we check it against 0 and to avoid gcc warnings for(int i=start;i<=last;i++) { - KoTextFormat* format=string->at(i).d.format; + KoTextFormat* format=string->at(i).format(); if((((!format->underline())&& (!format->doubleUnderline())&& @@ -621,5 +621,4 @@ KoTextParagLineStart *KoTextFormatter::k nc=0; current=0; - avg=0; } else if(format->underline()|| @@ -628,4 +627,5 @@ KoTextParagLineStart *KoTextFormatter::k { nc++; + // ### TODO: check if a formula with descent() instead of height() would not be better (for strikeout, use ascent()) current+=format->height(); }