Review Request: Prevent infinite layout-loop
Sebastian Sauer
mail at dipe.org
Wed Jul 27 14:50:56 BST 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102097/
-----------------------------------------------------------
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 it#s ave to assume that if we cannot create one more line then we are done? 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/1c440df3/attachment.htm>
More information about the calligra-devel
mailing list