From d12e86cb2b7fa5562078d0d71ffec8d8201e70d6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 28 Mar 2020 18:14:00 -0700 Subject: mobile/cleanup: use a mutex to protect storage access Instead of the crude and error prone bool, let's just use the right tool for this job. In order to avoid issues with a goto across a mutex boundary, this slightly restructures the code in one place - 'git show -w' makes it clear that this is really rather simple in its changes. Signed-off-by: Dirk Hohndel --- mobile-widgets/qmlmanager.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mobile-widgets/qmlmanager.h') diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index f3440cf75..5765667d0 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "core/btdiscovery.h" #include "core/gpslocation.h" @@ -255,7 +256,7 @@ private: QString m_notificationText; qreal m_lastDevicePixelRatio; QElapsedTimer timer; - bool alreadySaving; + QMutex alreadySaving; bool checkDate(const DiveObjectHelper &myDive, struct dive *d, QString date); bool checkLocation(DiveSiteChange &change, const DiveObjectHelper &myDive, struct dive *d, QString location, QString gps); bool checkDuration(const DiveObjectHelper &myDive, struct dive *d, QString duration); -- cgit v1.2.3-70-g09d2