Fix memory leaks&uninitialized members in QQuickContext2D&QQuickContext2DTexture
1) Delete m_buffer in QQuickContext2D::~QQuickContext2D 2) Add a default ctor for QQuickContext2D::State, although the reset() method is always called, but the valgrind still complains the "uninitialized" error, so add this to make an explicit initialization. 3) m_item in QQuickContext2DTexture is also not initialized. Change-Id: Ie6c74136342d7f0ff8dc268d5d6b976c95ff52f1 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
This commit is contained in:
parent
080af75aca
commit
c430ff551d
|
@ -3307,6 +3307,7 @@ QQuickContext2D::QQuickContext2D(QQuickCanvasItem* item)
|
|||
|
||||
QQuickContext2D::~QQuickContext2D()
|
||||
{
|
||||
delete m_buffer;
|
||||
}
|
||||
|
||||
v8::Handle<v8::Object> QQuickContext2D::v8value() const
|
||||
|
|
|
@ -107,6 +107,30 @@ public:
|
|||
|
||||
|
||||
struct State {
|
||||
State()
|
||||
: strokeStyle(QColor("#000000"))
|
||||
, fillStyle(QColor("#000000"))
|
||||
, fillPatternRepeatX(false)
|
||||
, fillPatternRepeatY(false)
|
||||
, strokePatternRepeatX(false)
|
||||
, strokePatternRepeatY(false)
|
||||
, fillRule(Qt::WindingFill)
|
||||
, globalAlpha(1.0)
|
||||
, lineWidth(1)
|
||||
, lineCap(Qt::FlatCap)
|
||||
, lineJoin(Qt::MiterJoin)
|
||||
, miterLimit(10)
|
||||
, shadowOffsetX(0)
|
||||
, shadowOffsetY(0)
|
||||
, shadowBlur(0)
|
||||
, shadowColor(qRgba(0, 0, 0, 0))
|
||||
, globalCompositeOperation(QPainter::CompositionMode_SourceOver)
|
||||
, font(QFont(QLatin1String("sans-serif"), 10))
|
||||
, textAlign(QQuickContext2D::Start)
|
||||
, textBaseline(QQuickContext2D::Alphabetic)
|
||||
{
|
||||
}
|
||||
|
||||
QTransform matrix;
|
||||
QPainterPath clipPath;
|
||||
QBrush strokeStyle;
|
||||
|
|
|
@ -72,6 +72,7 @@ Q_GLOBAL_STATIC(QThread, globalCanvasThreadRenderInstance)
|
|||
QQuickContext2DTexture::QQuickContext2DTexture()
|
||||
: QSGDynamicTexture()
|
||||
, m_context(0)
|
||||
, m_item(0)
|
||||
, m_canvasSize(QSize(1, 1))
|
||||
, m_tileSize(QSize(1, 1))
|
||||
, m_canvasWindow(QRect(0, 0, 1, 1))
|
||||
|
|
Loading…
Reference in New Issue