Review Request: Prevent infinite layout-loop

Casper Boemann cbr at boemann.dk
Wed Jul 27 15:19:32 BST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102097/#review5132
-----------------------------------------------------------

Ship it!


Fine with me, and no I don't think we need to do any further tests

- Casper


On July 27, 2011, 2:04 p.m., Sebastian Sauer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102097/
> -----------------------------------------------------------
> 
> (Updated July 27, 2011, 2:04 p.m.)
> 
> 
> Review request for Calligra and Casper Boemann.
> 
> 
> Summary
> -------
> 
> Attached patch fixes the case that in KoTextLayoutArea.cpp we could end in an infinite loop by trying to restart layouting the same line from text-position 0 again and again if at position 0 we had a soft-page-break and if the line itself had a textLength of zero (means the soft-page-break was the only character at the line).
> 
> The problem is that in the previous code we did;
> 
>     line = layout->createLine();
>     cursor->lineTextStart = line.isValid() ? line.textStart() : 0;
>     if (softBreak) {
>         return false;
>     }
> 
> what resulted in us trying to continue layouting the same line with soft-page-break again and again from position 0 The patch changes that to
> 
>     line = layout->createLine();
>     if (!line.isValid()) {
>         break;
>     }
>     cursor->lineTextStart = line.textStart();
>     if (softBreak) {
>         return false;
>     }
> 
> Now the question is if its save to assume that if we cannot create one more line then we are done (with that block)? Is that true or would it be better to add a condition somewhere that checks if cursor->lineTextStart < line.textStart() + line.textLength() (e.g. in restartLayout)?
> 
> 
> Diffs
> -----
> 
>   libs/textlayout/KoTextLayoutArea.cpp 05bf300 
> 
> Diff: http://git.reviewboard.kde.org/r/102097/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sebastian
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20110727/bfbf830e/attachment.htm>


More information about the calligra-devel mailing list