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>
Giuseppe D'Angelo 2019-05-14 20:01:35 +02:00
parent 0060ff6749
commit c7167509ac
2 changed files with 7 additions and 11 deletions

View File

@ -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;
}

View File

@ -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)