summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-11-12 13:47:42 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-11-12 13:47:42 (GMT)
commit7be079e1b1f13b58f5d69f86e5854edd25065532 (patch)
tree635c9dac7795a3479c3e4e4008935f81a0cb6623 /src/gui/painting
parentfab1ce65da8bacfce92b1df7656780e729d31b74 (diff)
downloadQt-7be079e1b1f13b58f5d69f86e5854edd25065532.zip
Qt-7be079e1b1f13b58f5d69f86e5854edd25065532.tar.gz
Qt-7be079e1b1f13b58f5d69f86e5854edd25065532.tar.bz2
Fixed a crash which could occur when perspective transforming QRegions.
This made the padnavigator example crash. Task-number: QTBUG-5674 Reviewed-by: Gunnar
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qregion.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index b48b024..401773b 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -3859,23 +3859,28 @@ QRegion::QRegion(const QRect &r, RegionType t)
QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule)
{
if (a.count() > 2) {
- d = new QRegionData;
- d->ref = 1;
+ QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(),
+ fillRule == Qt::WindingFill ? WindingRule : EvenOddRule);
+ if (qt_rgn) {
+ d = new QRegionData;
+ d->ref = 1;
#if defined(Q_WS_X11)
- d->rgn = 0;
- d->xrectangles = 0;
+ d->rgn = 0;
+ d->xrectangles = 0;
#elif defined(Q_WS_WIN)
- d->rgn = 0;
+ d->rgn = 0;
#endif
- d->qt_rgn = PolygonRegion(a.constData(), a.size(),
- fillRule == Qt::WindingFill ? WindingRule : EvenOddRule);
+ d->qt_rgn = qt_rgn;
+ } else {
+ d = &shared_empty;
+ d->ref.ref();
+ }
} else {
d = &shared_empty;
d->ref.ref();
}
}
-
QRegion::QRegion(const QRegion &r)
{
d = r.d;