summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli.qt@gmail.com>2019-12-26 21:27:48 +0100
committerpaolo <paolo.angelelli.qt@gmail.com>2020-01-14 20:40:26 +0100
commitb359faca3420916efd649b743501df3fdf5b6f35 (patch)
treeb49f6cadf5a45c61f0d7798ee777ceb19ada5cf2
parent912f7c727a4362c9530804d9bf1fd92062734af1 (diff)
downloadqtlocation-b359faca3420916efd649b743501df3fdf5b6f35.tar.gz
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 <alexander.blasche@qt.io>
-rw-r--r--src/location/labs/qmapcircleobject.cpp2
-rw-r--r--src/location/labs/qmappolygonobject.cpp2
-rw-r--r--src/location/labs/qmappolygonobject_p.h2
-rw-r--r--src/location/labs/qmappolygonobject_p_p.h2
-rw-r--r--src/location/labs/qmappolylineobject.cpp2
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<QMapCircleObjectPrivate*>(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<QMapPolygonObjectPrivate*>(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<QGeoCoordinate>
- 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<QMapPolylineObjectPrivate*>(d_ptr.data())->setColor(color);
});