diff options
author | Alexandre Rostovtsev <tetromino@gentoo.org> | 2014-05-28 04:22:55 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-07 19:02:58 (GMT) |
commit | 0db65e148dcb4d5e5b98475f207d41a287c401a1 (patch) | |
tree | 35477836377d64dc02daef550f927647fbfeb238 /src/gui | |
parent | d235363ed2e59604aae2f79a235b17e556a75fc0 (diff) | |
download | Qt-0db65e148dcb4d5e5b98475f207d41a287c401a1.zip Qt-0db65e148dcb4d5e5b98475f207d41a287c401a1.tar.gz Qt-0db65e148dcb4d5e5b98475f207d41a287c401a1.tar.bz2 |
Cleanlooks style: Fix floating point exception
In QCleanlooksStyle::drawControl, if indeterminate == true and
rect.width() == 4, we will end up with slideWidth of zero, and
take a mod by zero when calculating the value of step.
This causes a crash in Quassel 0.10; see
https://bugs.gentoo.org/show_bug.cgi?id=507124
Instead, calculate slideWidth based on max(width, minWidth) where
minWidth was already set as 4, ensuring that slideWidth >= 2.
Change-Id: I6678789105e359fa26c99409f449cad0ba3bd0ae
(cherry picked from qtstyleplugins/8ff2ac6035fb1d01f5c0054ba14afb949410e3a7)
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/styles/qcleanlooksstyle.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 504734a..3f665ca 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; |