From 12e4ac5d8157bb9eda511995f002158f79c23644 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 10 May 2020 11:03:53 +0200 Subject: [PATCH] DiskUsage: fix infinite loop when computing tab width Stop when we have a solution that is within 1px of accurate. Since tab width are rounded to the nearest pixel anyway, there is no need to compute further, and this could otherwise never converge due to rounding errors. Fixes #15944. --- src/apps/diskusage/ControlsView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/diskusage/ControlsView.cpp b/src/apps/diskusage/ControlsView.cpp index 67c1c84d00..a004b7465c 100644 --- a/src/apps/diskusage/ControlsView.cpp +++ b/src/apps/diskusage/ControlsView.cpp @@ -203,7 +203,7 @@ ControlsView::VolumeTabView::TabFrame(int32 index) const toShave -= margins[i] - newMargin; margins[i] = newMargin; } - } while (toShave > 0 && oldToShave != toShave); + } while (toShave > 0 && fabs(oldToShave - toShave) >= 1.0f); } for (int i = 0; i < index; i++)