diff options
author | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-08-03 18:37:24 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-08-04 08:11:53 +0000 |
commit | 3ab6239530810b482d6033bac3d781acea8453ac (patch) | |
tree | 1cdec7cc482c237c1552ce74ffd2a2e17eb431c0 /src/imports/location | |
parent | e7099f14c8faea4fb7c89877973b7cec75044cb3 (diff) | |
download | qtlocation-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>
Diffstat (limited to 'src/imports/location')
-rw-r--r-- | src/imports/location/qdeclarativepolylinemapitem.cpp | 4 |
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); |