summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-02-28 10:50:35 -0800
committerThiago Macieira <thiago.macieira@intel.com>2023-03-02 01:45:09 -0800
commit8dbceaa398d92c9c7492ffeb483f2bd6fab30c17 (patch)
tree44e2519dc132bf598f461b287b3a092a4336626e /src/gui/painting
parent52c7f699ac3124889b9c01fbc1fd542e30da6753 (diff)
QRegion: upgrade Q_ASSUME to Q_ASSERT
This is to fix the warning qregion.cpp:3582:12: error: ‘ET.EdgeTable::ymax’ may be used uninitialized [-Werror=maybe-uninitialized] Because the previous code in PolygonRegion() was: Q_ASSUME(Count > 1); But Q_ASSUME is becoming a no-op with GCC 12, so when this disappears, compiler rightly considered Count < 2 as a valid input. Therefore, when CreateETandAET() was called and had if (count < 2) return; The compiler again rightly concluded that it was a valid condition (after all, you're checking it!), leading to ET.ymax being used uninitialized. Since that Q_ASSUME really meant the condition of Count < 2 was not permitted, we may as well upgrade to Q_ASSERT in both places. Change-Id: I7f354474adce419ca6c2fffd1748119ef0092fa4 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qregion.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 457c2cc259..94f1f31e6a 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -3191,8 +3191,7 @@ static void CreateETandAET(int count, const QPoint *pts,
int iSLLBlock = 0;
int dy;
- if (count < 2)
- return;
+ Q_ASSERT(count > 1);
/*
* initialize the Active Edge Table
@@ -3538,7 +3537,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
POINTBLOCK *tmpPtBlock;
int numFullPtBlocks = 0;
- Q_ASSUME(Count > 1);
+ Q_ASSERT(Count > 1);
region = new QRegionPrivate;