QDBus: fix data race on isDebugging bool

Change-Id: Id0b8bf8dac570abfc6c8768bd4264650ae0c199b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
David Faure 2014-06-08 15:39:00 +02:00
parent 6bec36dd38
commit 7a4dcbaabf

View File

@ -73,8 +73,8 @@
QT_BEGIN_NAMESPACE
static bool isDebugging;
#define qDBusDebug if (!::isDebugging); else qDebug
static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
#define qDBusDebug if (::isDebugging == 0); else qDebug
Q_GLOBAL_STATIC_WITH_ARGS(const QString, orgFreedesktopDBusString, (QLatin1String(DBUS_SERVICE_DBUS)))
@ -1022,13 +1022,12 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
anonymousAuthenticationAllowed(false)
{
static const bool threads = q_dbus_threads_init_default();
static const int debugging = qgetenv("QDBUS_DEBUG").toInt();
::isDebugging = debugging;
if (::isDebugging == -1)
::isDebugging = qgetenv("QDBUS_DEBUG").toInt();
Q_UNUSED(threads)
Q_UNUSED(debugging)
#ifdef QDBUS_THREAD_DEBUG
if (debugging > 1)
if (::isDebugging > 1)
qdbusThreadDebug = qdbusDefaultThreadDebug;
#endif