https://bugs.kde.org/show_bug.cgi?id=428917

nyanpasu64 <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Latest Commit|                            |https://invent.kde.org/sdk/
                   |                            |kcachegrind/commit/36185dbe
                   |                            |85b8d68ff6f424d7f0032ae7077
                   |                            |0a866
         Resolution|---                         |FIXED

--- Comment #2 from nyanpasu64 <[email protected]> ---
Git commit 36185dbe85b8d68ff6f424d7f0032ae70770a866 by Nyan Pasu.
Committed on 09/11/2021 at 03:17.
Pushed by aacid into branch 'master'.

Fix hang in line-break algorithm

findBreak() previously mixed QFontMetrics::boundingRect().width() (the
width a string takes up, including left/right overhangs) and
QFontMetrics::horizontalAdvance() (which excludes overhangs). This
resulted in inconsistent behaviors within the function.

For borderline strings where fm->boundingRect(text).width() >= maxWidth
but fm->horizontalAdvance(text) < maxWidth, the code would not return
early, and would never exit the binary search loop because halfWidth <
maxWidth even when halfPos == text.length(). In fact, bottomPos gets set
to text.length() + 1 and the loop continues forever.

By consistently using QFontMetrics::boundingRect().width(), we make sure
the binary search loop always breaks out. It would be nice to add a
(halfWidth < maxWidth && halfPos < breakPos) check, but it's not
strictly necessary.

M  +2    -2    libviews/treemap.cpp

https://invent.kde.org/sdk/kcachegrind/commit/36185dbe85b8d68ff6f424d7f0032ae70770a866

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to