[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: [PATCH] Fix KoText crash (#52661)
From: Nicolas Goutte <nicolasg () snafu ! de>
Date: 2003-01-10 12:15:31
[Download RAW message or body]
After the totally wrong first patch (there was an additional logical error in
it), here is the second try.
Have a nice day/evening/night!
On Thursday 09 January 2003 23:34, David Faure wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thursday 09 January 2003 21:11, Nicolas Goutte wrote:
> > 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)
>
> Right. The code shouldn't use d.format at all, but chr->format(), which
> does the right thing.
> (Yes, this also means this patch is wrong...)
>
> - --
> David Faure -- faure@kde.org, dfaure@klaralvdalens-datakonsult.se
> Klarälvdalens Datakonsult AB, Platform-independent software solutions
> Contributing to: http://www.konqueror.org/, http://www.koffice.org/
> KOffice-1.2.1 is available - http://download.kde.org/stable/koffice-1.2.1/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
>
> iD8DBQE+Hfjo72KcVAmwbhARAqTKAJ471s10a8UTe/2xWEwDdbGGEkfLIACeMCpQ
> fHgYM0T+FCkU7EIhS9mcAzQ=
> =7X/7
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> koffice-devel mailing list
> koffice-devel@mail.kde.org
> http://mail.kde.org/mailman/listinfo/koffice-devel
["kotextformatter.diff" (text/x-diff)]
Index: kotextformatter.cc
===================================================================
RCS file: /home/kde/koffice/lib/kotext/kotextformatter.cc,v
retrieving revision 1.49
diff -u -r1.49 kotextformatter.cc
--- kotextformatter.cc 6 Jan 2003 17:33:53 -0000 1.49
+++ kotextformatter.cc 10 Jan 2003 12:13:26 -0000
@@ -604,10 +604,10 @@
}
}
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())&&
(format->underlineLineType()!=KoTextFormat::U_SIMPLE_BOLD))||
@@ -620,13 +620,13 @@
string->at(j).ulw=avg;
nc=0;
current=0;
- avg=0;
}
else if(format->underline()||
format->doubleUnderline()||
(format->underlineLineType() == KoTextFormat::U_SIMPLE_BOLD))
{
nc++;
+ // ### TODO: check if a formula with descent() instead of height() would \
not be better (for strikeout, use ascent()) current+=format->height();
}
}
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic