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

Albert Astals Cid <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/sdk/ |https://invent.kde.org/sdk/
                   |kcachegrind/commit/36185dbe |kcachegrind/commit/5e73b3e6
                   |85b8d68ff6f424d7f0032ae7077 |c816b3330f02d2628112da6245a
                   |0a866                       |7cf3d

--- Comment #3 from Albert Astals Cid <[email protected]> ---
Git commit 5e73b3e6c816b3330f02d2628112da6245a7cf3d by Albert Astals Cid, on
behalf of Nyan Pasu.
Committed on 22/11/2021 at 08:52.
Pushed by aacid into branch 'release/21.12'.

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.
(cherry picked from commit 36185dbe85b8d68ff6f424d7f0032ae70770a866)

M  +2    -2    libviews/treemap.cpp

https://invent.kde.org/sdk/kcachegrind/commit/5e73b3e6c816b3330f02d2628112da6245a7cf3d

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

Reply via email to