From e6ca346a80207f72c022ff59ec3c467454452041 Mon Sep 17 00:00:00 2001 From: Alexandre Rostovtsev Date: Sun, 13 Apr 2014 23:39:04 -0400 Subject: [PATCH] QCleanlooksStyle::drawControl : fix floating point exception If indeterminate == true, we can have rect.width() == 4, in which case slideWidth ends up zero, and we take a mod by zero. Instead, calculate slideWidth based on max(width, minWidth) where minWidth was already set as 4, ensuring that slideWidth >= 2. https://bugs.gentoo.org/show_bug.cgi?id=507124 --- src/gui/styles/qcleanlooksstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 0e0d050..d55d541 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -1773,7 +1773,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o } } else { Q_D(const QCleanlooksStyle); - int slideWidth = ((rect.width() - 4) * 2) / 3; + int slideWidth = (qMax(rect.width() - 4, minWidth) * 2) / 3; int step = ((d->animateStep * slideWidth) / d->animationFps) % slideWidth; if ((((d->animateStep * slideWidth) / d->animationFps) % (2 * slideWidth)) >= slideWidth) step = slideWidth - step; -- 1.9.2