diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-11-26 13:40:13 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-11-27 15:09:19 +0000 |
commit | cb19e1f7e3cc2cfee3b8fcbdfa5cd151826dadac (patch) | |
tree | 864ff8c95e0680a6e2ed4c275eca78035dbe9cb9 /src/location/maps | |
parent | fb23882d5bc697b2dfdd22c27d34c52d889d1200 (diff) | |
download | qtlocation-cb19e1f7e3cc2cfee3b8fcbdfa5cd151826dadac.tar.gz |
Fix error handling in QGeoServiceProvider
A dangerous local reference with the same name of a member variable
caused the latter not to be evaluated and the former not to be set.
Change-Id: Iaadcc3bce36f56ed8eeb77374687cf33632abd2f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/maps')
-rw-r--r-- | src/location/maps/qgeoserviceprovider.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/location/maps/qgeoserviceprovider.cpp b/src/location/maps/qgeoserviceprovider.cpp index c6b9d742..27332e88 100644 --- a/src/location/maps/qgeoserviceprovider.cpp +++ b/src/location/maps/qgeoserviceprovider.cpp @@ -362,7 +362,7 @@ template <> QNavigationManagerEngine *createEngine<QNavigationManagerEngine>(QGe { if (!d_ptr->factoryV2) return nullptr; - return d_ptr->factoryV2->createNavigationManagerEngine(d_ptr->cleanedParameterMap, &(d_ptr->placeError), &(d_ptr->placeErrorString)); + return d_ptr->factoryV2->createNavigationManagerEngine(d_ptr->cleanedParameterMap, &(d_ptr->navigationError), &(d_ptr->navigationErrorString)); } /* Template for generating the code for each of the geocodingManager(), @@ -381,11 +381,15 @@ Manager *QGeoServiceProviderPrivate::manager(QGeoServiceProvider::Error *_error, this->loadPlugin(this->parameterMap); } - if (!this->factory || error != QGeoServiceProvider::NoError) + if (!this->factory || this->error != QGeoServiceProvider::NoError) { + error = this->error; + errorString = this->errorString; return 0; + } if (!manager) { - Engine *engine = createEngine<Engine>(this); + Engine *engine = createEngine<Engine>(this); // this sets the specific error variables directly, + // from now on the local error, errorString refs should be set. if (engine) { engine->setManagerName( @@ -753,7 +757,7 @@ void QGeoServiceProviderPrivate::loadPlugin(const QVariantMap ¶meters) QObject *instance = loader()->instance(idx); if (!instance) { error = QGeoServiceProvider::LoaderError; - errorString = QLatin1String("loader()->instance(idx) failed to return an instance"); + errorString = QLatin1String("loader()->instance(idx) failed to return an instance. Set the environment variable QT_DEBUG_PLUGINS to see more details."); return; } factoryV3 = qobject_cast<QGeoServiceProviderFactoryV3 *>(instance); |