Bug 342185 - Drop Caps + fixed line spacing value low enough crashes
Summary: Drop Caps + fixed line spacing value low enough crashes
Status: RESOLVED FIXED
Alias: None
Product: calligracommon
Classification: Applications
Component: text-layout (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Calligra Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-24 10:04 UTC by mvowada
Modified: 2015-01-30 14:20 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Drop Caps + fixed line spacing value lower than 25.00, causes the crash of Krita - Backtrace (14.99 KB, text/plain)
2014-12-24 12:11 UTC, mvowada
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mvowada 2014-12-24 10:04:34 UTC
Drop Caps + fixed line spacing value lower than 25.00, causes the crashing of Krita.

(Krita 2+git20141221+r73452-51-dk)

Reproducible: Always

Steps to Reproduce:
1. Create and select the text of a multiline paragraph (Menu > Text tool > Tool Options > Text Options > Mode > Multiline).
2. Enable the feature "Drop caps" (Tool Options > Paragraph > Change paragraph format button (it's the one with the ellipsis glyph) > Drop Caps (tab) > Drop caps (checkbox)).
3. Stay on the same dialog but under the "Indent/Spacing" tab and choose for "Line Spacing" the "Fixed" option. Set its value lower than 25,00.

Actual Results:  
Krita should not crash.

Expected Results:  
Krita crashes.
Comment 1 Halla Rempt 2014-12-24 10:06:55 UTC
Hi!

Could you attach the backtrace of the crash for us?
Comment 2 mvowada 2014-12-24 10:34:43 UTC
I guess it's this line, is it? Thank you.

Application: Krita (krita), signal: Aborted
Comment 3 Halla Rempt 2014-12-24 10:39:45 UTC
Er no -- do you have the debug packages installed? If not, please install those and then make the crash happen again. You should be getting a bug report window that includes a "backtrace" tab, which should contain a lot of text. We need all of it...
Comment 4 mvowada 2014-12-24 12:11:48 UTC
Created attachment 90115 [details]
Drop Caps + fixed line spacing value lower than 25.00, causes the crash of Krita - Backtrace

Drop Caps + fixed line spacing value lower than 25.00, causes the crash of Krita - Backtrace
Comment 5 Halla Rempt 2014-12-24 12:13:42 UTC
Comment on attachment 90115 [details]
Drop Caps + fixed line spacing value lower than 25.00, causes the crash of Krita - Backtrace

Thanks!
Comment 6 mvowada 2014-12-24 12:41:01 UTC
Thank you. Incidentally, regarding the point 2 of the "Steps to Reproduce" above, I've better noticed that:

The checkbox isn't enough by itself to activate the drop caps. Besides that, one also has to increase the amount of "Number of lines it covers".
Comment 7 Halla Rempt 2015-01-29 11:03:11 UTC
Could you check whether this is also fixed now? I cannot reproduce it anymore using the steps given.
Comment 8 mvowada 2015-01-29 11:26:35 UTC
Resolved with the new build. I had checked also a few days ago but the issue was still there. But now it's completely resolved. Thank you very much!
Comment 9 Camilla Boemann 2015-01-30 11:39:15 UTC
still happens - and i'm able to reproduce in calligra words too
Comment 10 Camilla Boemann 2015-01-30 11:45:03 UTC
On Fri, 30 Jan 2015, Alex Demko wrote:

> 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.
Comment 11 Camilla Boemann 2015-01-30 14:20:23 UTC
Git commit 91cdb01d2aae13f7dfb67182913e75fa5166f699 by C. Boemann.
Committed on 30/01/2015 at 12:58.
Pushed by boemann into branch 'calligra/2.9'.

The dropcaps themselves should not be subjected to linespacing rules - only the actual lines of text should be

This bug resulted in a crash because the dropcap became smaller in height than it was displaced - effectively
painted completely above the paragraph - this resulted in a correct assert

M  +23   -19   libs/textlayout/KoTextLayoutArea.cpp

http://commits.kde.org/calligra/91cdb01d2aae13f7dfb67182913e75fa5166f699