QPainter: replace manual memory management [1/5]: dummyState

Use a unique_ptr to indicate ownership.

Change-Id: I15e8c48fac1424d5605e869adcfba6965b16c218
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Marc Mutz 2020-06-01 11:54:45 +02:00
parent 033e5dc183
commit dd7f4001e1
2 changed files with 5 additions and 4 deletions

View File

@ -222,7 +222,6 @@ QPainterPrivate::~QPainterPrivate()
{
delete emulationEngine;
qDeleteAll(states);
delete dummyState;
}

View File

@ -65,6 +65,8 @@
#include <private/qpen_p.h>
#include <memory>
QT_BEGIN_NAMESPACE
class QPaintEngine;
@ -206,7 +208,7 @@ public:
QPainterState *state;
QVarLengthArray<QPainterState *, 8> states;
mutable QPainterDummyState *dummyState;
mutable std::unique_ptr<QPainterDummyState> dummyState;
QTransform invMatrix;
uint txinv:1;
@ -221,8 +223,8 @@ public:
QPainterDummyState *fakeState() const {
if (!dummyState)
dummyState = new QPainterDummyState();
return dummyState;
dummyState = std::make_unique<QPainterDummyState>();
return dummyState.get();
}
void updateEmulationSpecifier(QPainterState *s);