diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-01 18:41:14 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-07-01 18:41:14 +0200 |
commit | e6a94778d0c26b59e367e9f9fe4f401725fc9c4e (patch) | |
tree | c7597213d7eac14863bc3cfd7bccd247c8950710 /src/dbus/qdbusintegrator.cpp | |
parent | 605ba2c2268b2dce3d0b06899101d03a67e7f251 (diff) | |
parent | a09a8d509a69ed16d8afbe15296b8332cacd6c66 (diff) |
Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index d4079e8076..9533d6b733 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -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 @@ -2488,12 +2487,15 @@ void QDBusConnectionPrivate::unregisterServiceNoLock(const QString &serviceName) serviceNames.removeAll(serviceName); } -bool QDBusConnectionPrivate::isServiceRegisteredByThread(const QString &serviceName) const +bool QDBusConnectionPrivate::isServiceRegisteredByThread(const QString &serviceName) { if (!serviceName.isEmpty() && serviceName == baseService) return true; - QStringList copy = serviceNames; - return copy.contains(serviceName); + if (serviceName == dbusServiceString()) + return false; + + QDBusReadLocker locker(UnregisterServiceAction, this); + return serviceNames.contains(serviceName); } void QDBusConnectionPrivate::postEventToThread(int action, QObject *object, QEvent *ev) |