summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-08-03 18:37:24 +0200
committerPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-08-04 08:11:53 +0000
commit3ab6239530810b482d6033bac3d781acea8453ac (patch)
tree1cdec7cc482c237c1552ce74ffd2a2e17eb431c0
parente7099f14c8faea4fb7c89877973b7cec75044cb3 (diff)
downloadqtlocation-3ab6239530810b482d6033bac3d781acea8453ac.tar.gz
Fix accessing a MapPolyline delegate before it is handed over to Map
QDeclarativePolylineMapItem::path() currently retrieves a QQmlContext with contextForObject(parent). This can return a null context if the parent is null. This patch changes the parameter to the this pointer, returning the context for the object itself. Task-number: QTBUG-55081 Change-Id: I48d6abd8be1b3d9505e37338da2b64812375374c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index f2373abf..75c1bfab 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -498,7 +498,9 @@ void QDeclarativePolylineMapItem::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *
QJSValue QDeclarativePolylineMapItem::path() const
{
- QQmlContext *context = QQmlEngine::contextForObject(parent());
+ QQmlContext *context = QQmlEngine::contextForObject(this);
+ if (!context)
+ return QJSValue();
QQmlEngine *engine = context->engine();
QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine);