diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2019-05-14 20:01:35 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2019-05-14 20:07:49 +0200 |
commit | c7167509acdba006fe6da4ec1866acb214c18197 (patch) | |
tree | d13526af6ec4c5aa08f5381b0120ad0ba87e68d5 /src/gui/painting/qpainterpath_p.h | |
parent | 0060ff674910fd7e81f36c508547367d3c5d4a8c (diff) |
QPainterPath: convert manual memory management to std::unique_ptr
And default the destructor, now that it's empty.
Change-Id: I868d4fa04f8e82bc35f2364073d07fa47659b89c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/gui/painting/qpainterpath_p.h')
-rw-r--r-- | src/gui/painting/qpainterpath_p.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 8af811499b..4eb541ec65 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -62,6 +62,8 @@ #include <private/qvectorpath_p.h> #include <private/qstroker_p.h> +#include <memory> + QT_BEGIN_NAMESPACE // ### Qt 6: merge with QPainterPathData @@ -202,11 +204,7 @@ public: } QPainterPathData &operator=(const QPainterPathData &) = delete; - - ~QPainterPathData() - { - delete pathConverter; - } + ~QPainterPathData() = default; inline bool isClosed() const; inline void close(); @@ -215,7 +213,7 @@ public: const QVectorPath &vectorPath() { if (!pathConverter) - pathConverter = new QVectorPathConverter(elements, fillRule, convex); + pathConverter.reset(new QVectorPathConverter(elements, fillRule, convex)); return pathConverter->path; } @@ -230,7 +228,7 @@ public: uint dirtyControlBounds : 1; uint convex : 1; - QVectorPathConverter *pathConverter; + std::unique_ptr<QVectorPathConverter> pathConverter; }; @@ -324,8 +322,7 @@ inline void QPainterPathData::clear() dirtyControlBounds = false; convex = false; - delete pathConverter; - pathConverter = nullptr; + pathConverter.reset(); } #define KAPPA qreal(0.5522847498) |