From b359faca3420916efd649b743501df3fdf5b6f35 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Thu, 26 Dec 2019 21:27:48 +0100 Subject: Fix MapObjects ::border property not properly initialized This patch also parents it with the object also fixing memory leaks. Change-Id: I74a21176b1d2450b10a21f92321520ca2c6e88e0 Reviewed-by: Alex Blasche --- src/location/labs/qmapcircleobject.cpp | 2 +- src/location/labs/qmappolygonobject.cpp | 2 +- src/location/labs/qmappolygonobject_p.h | 2 +- src/location/labs/qmappolygonobject_p_p.h | 2 +- src/location/labs/qmappolylineobject.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/location/labs/qmapcircleobject.cpp b/src/location/labs/qmapcircleobject.cpp index 5f0db29d..fdfc834d 100644 --- a/src/location/labs/qmapcircleobject.cpp +++ b/src/location/labs/qmapcircleobject.cpp @@ -250,7 +250,7 @@ QColor QMapCircleObject::color() const QDeclarativeMapLineProperties *QMapCircleObject::border() { if (!m_border) { - m_border = new QDeclarativeMapLineProperties; + m_border = new QDeclarativeMapLineProperties(this); connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ static_cast(d_ptr.data())->setBorderColor(color); }); diff --git a/src/location/labs/qmappolygonobject.cpp b/src/location/labs/qmappolygonobject.cpp index 6ccba748..5a8ce228 100644 --- a/src/location/labs/qmappolygonobject.cpp +++ b/src/location/labs/qmappolygonobject.cpp @@ -250,7 +250,7 @@ QColor QMapPolygonObject::color() const QDeclarativeMapLineProperties *QMapPolygonObject::border() { if (!m_border) { - m_border = new QDeclarativeMapLineProperties; + m_border = new QDeclarativeMapLineProperties(this); connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ static_cast(d_ptr.data())->setBorderColor(color); }); diff --git a/src/location/labs/qmappolygonobject_p.h b/src/location/labs/qmappolygonobject_p.h index 03eef587..e924afab 100644 --- a/src/location/labs/qmappolygonobject_p.h +++ b/src/location/labs/qmappolygonobject_p.h @@ -82,7 +82,7 @@ signals: void colorChanged(); protected: - QDeclarativeMapLineProperties *m_border; + QDeclarativeMapLineProperties *m_border = nullptr; }; QT_END_NAMESPACE diff --git a/src/location/labs/qmappolygonobject_p_p.h b/src/location/labs/qmappolygonobject_p_p.h index 767765df..52bbaf4c 100644 --- a/src/location/labs/qmappolygonobject_p_p.h +++ b/src/location/labs/qmappolygonobject_p_p.h @@ -103,7 +103,7 @@ public: public: QGeoPolygon m_path; // small overhead compared to plain QList - QColor m_borderColor; + QColor m_borderColor = Qt::transparent; QColor m_fillColor = Qt::transparent; qreal m_borderWidth = 0; diff --git a/src/location/labs/qmappolylineobject.cpp b/src/location/labs/qmappolylineobject.cpp index c6d3cdaf..81390d7c 100644 --- a/src/location/labs/qmappolylineobject.cpp +++ b/src/location/labs/qmappolylineobject.cpp @@ -191,7 +191,7 @@ QVariantList QMapPolylineObject::path() const QDeclarativeMapLineProperties *QMapPolylineObject::border() { if (!m_border) { - m_border = new QDeclarativeMapLineProperties; + m_border = new QDeclarativeMapLineProperties(this); connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ static_cast(d_ptr.data())->setColor(color); }); -- cgit v1.2.1