Tracked down a busy loop that I could reproduce pretty reliably with

tool tips in WonderBrush. The reason was that the text rect is getting
smaller and smaller each time the tool tip is shown (even though there
is only one word), and the line break moves one char towards the beginning
each time. After four times, the busy loop would kick in reliably. I cannot
really say that I understand the code, though. But that's the spot anyways.
Stefano, could you have a look?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28471 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-11-02 21:40:44 +00:00
parent f9f1555066
commit c470027d27

View File

@ -3485,7 +3485,7 @@ BTextView::_Refresh(int32 fromOffset, int32 toOffset, bool erase, bool scroll)
// if the line breaks have changed, force an erase
if (fromLine != saveFromLine || toLine != saveToLine
|| newHeight != saveHeight ) {
|| newHeight != saveHeight) {
erase = true;
fromOffset = -1;
}
@ -3566,7 +3566,7 @@ BTextView::_RecalculateLineBreaks(int32 *startLine, int32 *endLine)
int32 nextOffset = _NextInitialByte(fromOffset);
if (toOffset < nextOffset && fromOffset < textLength)
toOffset = nextOffset;
// set the ascent of this line
curLine->ascent = ascent;
@ -3767,6 +3767,7 @@ BTextView::_FindLineBreak(int32 fromOffset, float *outAscent, float *outDescent,
offset += delta;
delta = 0;
} while (offset < limit && !done);
if (offset - fromOffset < 1) {
@ -3777,7 +3778,7 @@ BTextView::_FindLineBreak(int32 fromOffset, float *outAscent, float *outDescent,
strWidth = 0.0;
int32 current = fromOffset;
for (offset = fromOffset; offset <= limit; current = offset,
for (offset = fromOffset; offset < limit; current = offset,
offset = _NextInitialByte(offset)) {
strWidth += _StyledWidth(current, offset - current, &ascent,
&descent);