From 88550543f8b4b7c76bffeebb923ad1f72b774b6e Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 3 Mar 2015 14:44:46 +0100 Subject: Painting: Avoid endless loop for certain bezier curves If the coordinates were too close (at the limit of the number accuracy), the splitting algorithm in QBezier::shifted() would never finish. Ref. testcase in bugreport. Task-number: QTBUG-44674 Change-Id: I2a575cdc6284504ef5e3eb2b749857576fe433c3 Reviewed-by: Gunnar Sletta --- src/gui/painting/qbezier.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 90240d1752..a741c94c16 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -402,8 +402,8 @@ int QBezier::shifted(QBezier *curveSegments, int maxSegments, qreal offset, floa Q_ASSERT(curveSegments); Q_ASSERT(maxSegments > 0); - if (x1 == x2 && x1 == x3 && x1 == x4 && - y1 == y2 && y1 == y3 && y1 == y4) + if (qFuzzyCompare(x1, x2) && qFuzzyCompare(x1, x3) && qFuzzyCompare(x1, x4) && + qFuzzyCompare(y1, y2) && qFuzzyCompare(y1, y3) && qFuzzyCompare(y1, y4)) return 0; --maxSegments; -- cgit v1.2.3