summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingregistry_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-02-18 09:06:00 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-02-20 07:23:59 +0000
commit567abeaa04db2c30f0d9a5cb95e11d295ad88784 (patch)
tree71785686c622963394878eb7554869cf60697c2a /src/corelib/io/qloggingregistry_p.h
parent10d0f4cba99d2386db28a3afd71832e35992b797 (diff)
QLoggingRegistry: fix potential data race
The 'rules' vector is made up of all the individual {env,config,...}Rules vectors under mutex protection whenever init() is called (only from the QCoreApplication ctor) or, at any time, by a call to QLoggingCategory:: setFilterRules(). Yet, the writes to the individual *Rules vectors were never protected by registryMutex, racing against the reads of the same vectors in the updateRules() function. Fix by protecting all access of all member variables with registryMutex. Add some strategic comments to make analysis easier for the next guy. Change-Id: If68d15a553ec7038693574a34f10a39f4cd480e8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/io/qloggingregistry_p.h')
-rw-r--r--src/corelib/io/qloggingregistry_p.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h
index 5197da1ba4..23740c4955 100644
--- a/src/corelib/io/qloggingregistry_p.h
+++ b/src/corelib/io/qloggingregistry_p.h
@@ -129,6 +129,7 @@ private:
QMutex registryMutex;
+ // protected by mutex:
QVector<QLoggingRule> qtConfigRules;
QVector<QLoggingRule> configRules;
QVector<QLoggingRule> envRules;