From 8a113985cda1693c8158916065bd54e57d028cda Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Mon, 1 Dec 2014 11:39:33 +0100 Subject: [PATCH 16/30] Use an QAtomicInt instead of a plain bool for Entity::cacheEnabled. A plain bool is not thread safe and leads to undefined behavior. So better be safe than sorry and use a thread safe QAtomicInt. --- server/src/storage/entities-source.xsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/storage/entities-source.xsl b/server/src/storage/entities-source.xsl index 05a8cb1..e398da5 100644 --- a/server/src/storage/entities-source.xsl +++ b/server/src/storage/entities-source.xsl @@ -99,7 +99,7 @@ class ::Private : public QSharedData static void addToCache( const & entry ); // cache - static bool cacheEnabled; + static QAtomicInt cacheEnabled; static QMutex cacheMutex; static QHash<qint64, > idCache; @@ -111,7 +111,7 @@ class ::Private : public QSharedData // static members -bool ::Private::cacheEnabled = false; +QAtomicInt ::Private::cacheEnabled(0); QMutex ::Private::cacheMutex; QHash<qint64, > ::Private::idCache; -- 2.1.0