From 46d9a630a88fc5388dec7fd99289d0e9e0e1f680 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 24 Aug 2016 14:19:40 +0200 Subject: iOS: protect OS sensors from being stopped when shared by several Qt sensors When a Qt sensor is told to stop, it automatically stops the underlying OS sensor as well. This caused a problem when several Qt sensors were running, since stopping one would stop them all. This patch will add a ref count for each affected sensor, so that we keep track of when it's safe to start and stop the underlying OS sensor. Task-number: QTBUG-54977 Change-Id: If06c4daac22916feef2f4c7bd521363d74f342a6 Reviewed-by: Edward Welbourne Reviewed-by: Lorn Potter --- src/plugins/sensors/ios/iosmagnetometer.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/sensors/ios/iosmagnetometer.h') diff --git a/src/plugins/sensors/ios/iosmagnetometer.h b/src/plugins/sensors/ios/iosmagnetometer.h index f6430f5d..b8e611d2 100644 --- a/src/plugins/sensors/ios/iosmagnetometer.h +++ b/src/plugins/sensors/ios/iosmagnetometer.h @@ -60,6 +60,9 @@ private: QMagnetometerReading m_reading; int m_timer; bool m_returnGeoValues; + + static int s_magnetometerStartCount; + static int s_deviceMotionStartCount; }; QT_END_NAMESPACE -- cgit v1.2.3