Review Request: Prevent infinite layout-loop
Sebastian Sauer
mail at dipe.org
Wed Jul 27 15:04:46 BST 2011
-----------------------------------------------------------
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 (updated)
-------
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/915cacb0/attachment.htm>
More information about the calligra-devel
mailing list