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:
parent
033e5dc183
commit
dd7f4001e1
@ -222,7 +222,6 @@ QPainterPrivate::~QPainterPrivate()
|
|||||||
{
|
{
|
||||||
delete emulationEngine;
|
delete emulationEngine;
|
||||||
qDeleteAll(states);
|
qDeleteAll(states);
|
||||||
delete dummyState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@
|
|||||||
|
|
||||||
#include <private/qpen_p.h>
|
#include <private/qpen_p.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QPaintEngine;
|
class QPaintEngine;
|
||||||
@ -206,7 +208,7 @@ public:
|
|||||||
QPainterState *state;
|
QPainterState *state;
|
||||||
QVarLengthArray<QPainterState *, 8> states;
|
QVarLengthArray<QPainterState *, 8> states;
|
||||||
|
|
||||||
mutable QPainterDummyState *dummyState;
|
mutable std::unique_ptr<QPainterDummyState> dummyState;
|
||||||
|
|
||||||
QTransform invMatrix;
|
QTransform invMatrix;
|
||||||
uint txinv:1;
|
uint txinv:1;
|
||||||
@ -221,8 +223,8 @@ public:
|
|||||||
|
|
||||||
QPainterDummyState *fakeState() const {
|
QPainterDummyState *fakeState() const {
|
||||||
if (!dummyState)
|
if (!dummyState)
|
||||||
dummyState = new QPainterDummyState();
|
dummyState = std::make_unique<QPainterDummyState>();
|
||||||
return dummyState;
|
return dummyState.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateEmulationSpecifier(QPainterState *s);
|
void updateEmulationSpecifier(QPainterState *s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user