Cleanlooks style: Fix floating point exception
authorAlexandre Rostovtsev <tetromino@gentoo.org>
Wed, 28 May 2014 04:22:55 +0000 (00:22 -0400)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 7 Jun 2014 19:02:58 +0000 (21:02 +0200)
commit0db65e148dcb4d5e5b98475f207d41a287c401a1
tree35477836377d64dc02daef550f927647fbfeb238
parentd235363ed2e59604aae2f79a235b17e556a75fc0
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>
src/gui/styles/qcleanlooksstyle.cpp