summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2019-10-25 11:25:44 +0200
committerSzabolcs David <davidsz@inf.u-szeged.hu>2019-10-25 12:14:10 +0200
commit303a9ec664b138050190306be76fa201dcc27cc8 (patch)
tree2708e9da2e3e756f4cb893373ec9d3b1fa5427f2 /src
parent25a220dd7370acdf04ee8f6d2d59f25d81cf42c7 (diff)
downloadqtlocation-303a9ec664b138050190306be76fa201dcc27cc8.tar.gz
Fix flakiness of QGeoPositionInfoSource::createDefaultSource()
After ac899dcc4, createDefaultSource() uses the first available position plugin to create an info source - even if that is not valid. The non-deterministically sorted list of plugins results a flaky behavior, especially when two plugins (geoclue2 and serialnmea) have the same priority and one of them is unconfigured and not supposed to work. Bring back the ability to find the first valid position plugin. Change-Id: I82947e59252ac3727478fe14fd328338b54b4dea Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/positioning/qgeopositioninfosource.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/positioning/qgeopositioninfosource.cpp b/src/positioning/qgeopositioninfosource.cpp
index 4690f8a3..0610bd79 100644
--- a/src/positioning/qgeopositioninfosource.cpp
+++ b/src/positioning/qgeopositioninfosource.cpp
@@ -374,8 +374,11 @@ QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(const QVaria
QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
foreach (const QJsonObject &obj, plugins) {
if (obj.value(QStringLiteral("Position")).isBool()
- && obj.value(QStringLiteral("Position")).toBool())
- return createSource_real(obj, parameters, parent);
+ && obj.value(QStringLiteral("Position")).toBool()) {
+ QGeoPositionInfoSource *source = createSource_real(obj, parameters, parent);
+ if (source)
+ return source;
+ }
}
return nullptr;
}