Commit dc384a23 authored by Oliver Wolff's avatar Oliver Wolff
Browse files

winrt: Remove incorrect asserts and fix incorrect condition


setPreferredPositioningMethods and setUpdateInterval are called by init so
these functions should not assert in initializing state.

Additionally the early exit condition in setPreferredPositioningMethods
has to be the same as in setUpdateInterval. Both cases have to return
early if the locator has not been initialized. This initialization
happens in init, so both states, Initializing and Initialized, are fine
for further handling.

Change-Id: I4ef8db7178c38299328041a8d163a1b9bbecc5b1
Reviewed-by: default avatarAndre de la Rocha <andre.rocha@qt.io>
Reviewed-by: default avatarMiguel Costa <miguel.costa@qt.io>
Showing with 1 addition and 3 deletions
...@@ -226,11 +226,10 @@ void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInf ...@@ -226,11 +226,10 @@ void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInf
PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods(); PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods();
QGeoPositionInfoSource::setPreferredPositioningMethods(methods); QGeoPositionInfoSource::setPreferredPositioningMethods(methods);
if (previousPreferredPositioningMethods == preferredPositioningMethods() if (previousPreferredPositioningMethods == preferredPositioningMethods()
|| d->initState != InitializationState::Uninitialized) { || d->initState == InitializationState::Uninitialized) {
return; return;
} }
Q_ASSERT(d->initState != InitializationState::Initializing);
const bool needsRestart = d->positionToken.value != 0 || d->statusToken.value != 0; const bool needsRestart = d->positionToken.value != 0 || d->statusToken.value != 0;
if (needsRestart) if (needsRestart)
...@@ -257,7 +256,6 @@ void QGeoPositionInfoSourceWinRT::setUpdateInterval(int msec) ...@@ -257,7 +256,6 @@ void QGeoPositionInfoSourceWinRT::setUpdateInterval(int msec)
return; return;
} }
Q_ASSERT(d->initState != InitializationState::Initializing);
// minimumUpdateInterval is initialized to the lowest possible update interval in init(). // minimumUpdateInterval is initialized to the lowest possible update interval in init().
// Passing 0 will cause an error on Windows 10. // Passing 0 will cause an error on Windows 10.
// See https://docs.microsoft.com/en-us/uwp/api/windows.devices.geolocation.geolocator.reportinterval // See https://docs.microsoft.com/en-us/uwp/api/windows.devices.geolocation.geolocator.reportinterval
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment