From f16f4a231cd10867c10eb42fb456867469c93836 Mon Sep 17 00:00:00 2001 From: Alex Leung Date: Tue, 3 Mar 2020 10:25:48 -0500 Subject: Support custom Mapbox API base URLs Added support for custom Mapbox API base URLs. Fixes: QTBUG-82655 Change-Id: Ieebcc834f8aeaeb223b036100e5edadd55749101 Reviewed-by: Alex Blasche --- src/location/doc/src/plugins/mapboxgl.qdoc | 4 ++++ .../geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/location/doc/src/plugins/mapboxgl.qdoc b/src/location/doc/src/plugins/mapboxgl.qdoc index 119868d1..f2cea8e8 100644 --- a/src/location/doc/src/plugins/mapboxgl.qdoc +++ b/src/location/doc/src/plugins/mapboxgl.qdoc @@ -87,6 +87,10 @@ The following table lists optional parameters that can be passed to the Mapbox p When not set, a development token will be used by default. The development token is subject to the Mapbox \l{https://www.mapbox.com/tos}{Terms of Services} and must not be used in production. This property has no effect on styles hosted outside the Mapbox servers. +\row + \li mapboxgl.api_base_url + \li Set a custom API base URL. When not set, the URL defaults to \l{https://api.mapbox.com}. + This parameter is ignored if the the \b mapboxgl.china property is set. \row \li mapboxgl.china \li Use Mapbox China API base URLs and styles. diff --git a/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp index 5cbde041..cde7871e 100644 --- a/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp +++ b/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp @@ -73,6 +73,11 @@ QGeoMappingManagerEngineMapboxGL::QGeoMappingManagerEngineMapboxGL(const QVarian m_useChinaEndpoint = parameters.value(QStringLiteral("mapboxgl.china")).toBool(); } + if (parameters.contains(QStringLiteral("mapboxgl.api_base_url"))) { + const QString apiBaseUrl = parameters.value(QStringLiteral("mapboxgl.api_base_url")).toString(); + m_settings.setApiBaseUrl(apiBaseUrl); + } + QVariantMap metadata; metadata["isHTTPS"] = true; -- cgit v1.2.1 From ccfcf832862582cd0e7c6b33547c9bf9d3b47240 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 15 Jan 2020 15:13:27 +0100 Subject: winrt: Fix crash on exit Using a static ComPtr in requestAccess might cause a crash on exit as this pointer might be cleaned up after the application has exited. Make sure, that this pointer is deleted together with the rest by making it part of the d pointer. Fixes: QTBUG-80711 Change-Id: I93c09a4549967195101de07b3cef430f8cd52229 Reviewed-by: Andy Shaw Reviewed-by: Alex Blasche --- src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp index a9cc164f..28a405c3 100644 --- a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp +++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp @@ -115,6 +115,7 @@ enum class InitializationState { class QGeoPositionInfoSourceWinRTPrivate { public: ComPtr locator; + mutable ComPtr statics; QTimer periodicTimer; QTimer singleUpdateTimer; QGeoPositionInfo lastPosition; @@ -638,21 +639,21 @@ HRESULT QGeoPositionInfoSourceWinRT::onStatusChanged(IGeolocator *, IStatusChang bool QGeoPositionInfoSourceWinRT::requestAccess() const { + Q_D(const QGeoPositionInfoSourceWinRT); qCDebug(lcPositioningWinRT) << __FUNCTION__; GeolocationAccessStatus accessStatus; - static ComPtr statics; ComPtr> op; HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([&op]() { + hr = QEventDispatcherWinRT::runOnXamlThread([&op, d]() { HRESULT hr; - if (!statics) { + if (!d->statics) { hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Geolocation_Geolocator).Get(), - IID_PPV_ARGS(&statics)); + IID_PPV_ARGS(&d->statics)); RETURN_HR_IF_FAILED("Could not access Geolocation Statics."); } - hr = statics->RequestAccessAsync(&op); + hr = d->statics->RequestAccessAsync(&op); return hr; }); if (FAILED(hr)) { -- cgit v1.2.1