diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 956b7f5514..42872359d7 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -3499,8 +3499,7 @@ void QPainterPath::setDirty(bool dirty) { d_func()->dirtyBounds = dirty; d_func()->dirtyControlBounds = dirty; - delete d_func()->pathConverter; - d_func()->pathConverter = 0; + d_func()->pathConverter.reset(); d_func()->convex = false; } 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 #include +#include + 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 pathConverter; }; @@ -324,8 +322,7 @@ inline void QPainterPathData::clear() dirtyControlBounds = false; convex = false; - delete pathConverter; - pathConverter = nullptr; + pathConverter.reset(); } #define KAPPA qreal(0.5522847498)