crash bug Bug 342185

Alex Demko ademko at gmail.com
Fri Jan 30 06:27:59 UTC 2015


Although the submitter reported this bug resolved, I think it's still
open, as I'm able to reliably reproduce it in the most recent
calligra/2.9 branch. If I increase Drop Caps->Number It Covers to say
4, and then keep decrementing Indents/Spacing->Line Spaces->Fixes
lower and lower, around 9 or so I can get it to crash. I assume it's
all dependant on the font any ways.

The bug triggers the assert in:

void KoTextLayoutArea::setBottom(qreal bottom)
{
    d->boundingRect.setBottom(bottom + qMax(qreal(0.0),
d->verticalAlignOffset));
    Q_ASSERT_X(d->boundingRect.top() <= d->boundingRect.bottom(),
__FUNCTION__, "Bounding-rect is not normalized");
    d->bottom = bottom;
}

Which is understandable because bottom in my case is -9.57456e-13, aka
-tiny. With top()==0 and bottom()==-tiny, it's not normalized. How did
it become -tiny and not real 0? It seems in this bit of code:

libs/textlayout/KoTextLayoutArea.cpp:1295:

        d->neededWidth = qMax(d->neededWidth, line.naturalTextWidth()
+ d->indent);

        if (!runAroundHelper.stayOnBaseline() &&
!(block.blockFormat().hasProperty(KoParagraphStyle::HiddenByTable)
         && block.length() <= 1)) {
// d-> is -6 and maxLineHeight is 6
            d->y += maxLineHeight;  // <---- the culprit
// d->y is now -tiny
            maxLineHeight = 0;
            d->indent = 0;
            d->extraTextIndent = 0;
            ++numBaselineShifts;
        }


It seems -6 + 6 gives us -tiny, which is understandable as this all in
real numbers and round off errors are expected.

Now, this is inside KoTextLayoutArea::layoutBlock(), which is quite
the monster, so it might be easier for devs familiar with this code to
handle it. Alternatively, I can fix it, but I'd need to know the
approach... Can d->y be reset to its entry value? Can it be reset to
0? etc.

Thanks


More information about the kimageshop mailing list