From c470027d27f5c4e48d7706834b6eb8a78ad393a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 2 Nov 2008 21:40:44 +0000 Subject: [PATCH] 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 --- src/kits/interface/TextView.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index d3f73158dc..9deee35abb 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -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);