Review Request: Prevent infinite layout-loop

Commit Hook null at kde.org
Thu Jul 28 11:04:49 BST 2011


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


This review has been submitted with commit 4104ab4dc622b2390b22072dcc49d9c3596f23f1 by Sebastian Sauer to branch master.

- Commit


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/20110728/45008999/attachment.htm>


More information about the calligra-devel mailing list