summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainterpath.cpp
diff options
context:
space:
mode:
authorHarald Fernengel <harald@trolltech.com>2009-06-15 12:17:17 (GMT)
committerHarald Fernengel <harald@trolltech.com>2009-06-15 12:17:17 (GMT)
commit217d263ee1feb5a0c2b19d634093f4c7975ac7c9 (patch)
tree72bdeece4c24b515926a6904b53d484e61b3d534 /src/gui/painting/qpainterpath.cpp
parent2a91ca517826c8a4e5f432ad026106542f02f852 (diff)
downloadQt-217d263ee1feb5a0c2b19d634093f4c7975ac7c9.zip
Qt-217d263ee1feb5a0c2b19d634093f4c7975ac7c9.tar.gz
Qt-217d263ee1feb5a0c2b19d634093f4c7975ac7c9.tar.bz2
Fixes leak introduced by QScopedPointer
QPainterPath is kinda evil with a somewhat public private class and a really private cast, so we need to up-cast the d pointer when deleting. RevBy: aportale
Diffstat (limited to 'src/gui/painting/qpainterpath.cpp')
-rw-r--r--src/gui/painting/qpainterpath.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 12dbc62..635218e 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -73,6 +73,24 @@
QT_BEGIN_NAMESPACE
+struct QPainterPathPrivateHandler
+{
+ static inline void cleanup(QPainterPathPrivate *d)
+ {
+ // note - we must up-cast to QPainterPathData since QPainterPathPrivate
+ // has a non-virtual destructor!
+ if (d && !d->ref.deref())
+ delete static_cast<QPainterPathData *>(d);
+ }
+
+ static inline void reset(QPainterPathPrivate *&d, QPainterPathPrivate *other)
+ {
+ QPainterPathPrivate *oldD = d;
+ d = other;
+ cleanup(oldD);
+ }
+};
+
// This value is used to determine the length of control point vectors
// when approximating arc segments as curves. The factor is multiplied
// with the radius of the circle.