diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-03-30 23:08:03 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-03-30 23:58:30 (GMT) |
commit | 068652a52f0554b5ceb56798fe5ac4e5049bb9e3 (patch) | |
tree | a8a5a1276ecd42edc07a9a68f205c0e8449048c5 /src/gui | |
parent | 462429f5692f810bdd4e04b916db5f9af428d9e4 (diff) | |
download | Qt-068652a52f0554b5ceb56798fe5ac4e5049bb9e3.zip Qt-068652a52f0554b5ceb56798fe5ac4e5049bb9e3.tar.gz Qt-068652a52f0554b5ceb56798fe5ac4e5049bb9e3.tar.bz2 |
Rotation transform with NaN angle can cause crash
When used in conjunction with Text resulted in massive memory
consunmption.
Change-Id: I5e19cb54bcd57b1ea32d17641f976f8288611a9e
Task-number: QTBUG-18386
Reviewed-by: Charles Yin
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicstransform.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 06df788..513c41f 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -92,6 +92,7 @@ #include "qgraphicstransform_p.h" #include <QDebug> #include <QtCore/qmath.h> +#include <QtCore/qnumeric.h> #ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE @@ -467,6 +468,7 @@ void QGraphicsRotation::setOrigin(const QVector3D &point) item will be rotated counter-clockwise. Normally the rotation angle will be in the range (-360, 360), but you can also provide numbers outside of this range (e.g., a angle of 370 degrees gives the same result as 10 degrees). + Setting the angle to NaN results in no rotation. \sa origin */ @@ -570,7 +572,7 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const { Q_D(const QGraphicsRotation); - if (d->angle == 0. || d->axis.isNull()) + if (d->angle == 0. || d->axis.isNull() || qIsNaN(d->angle)) return; matrix->translate(d->origin); |