summaryrefslogtreecommitdiffstats
path: root/src/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/qdbusabstractadaptor_p.h4
-rw-r--r--src/dbus/qdbusabstractinterface.cpp34
-rw-r--r--src/dbus/qdbusabstractinterface.h6
-rw-r--r--src/dbus/qdbusargument.cpp10
-rw-r--r--src/dbus/qdbusargument.h6
-rw-r--r--src/dbus/qdbusconnection.cpp16
-rw-r--r--src/dbus/qdbusconnection.h2
-rw-r--r--src/dbus/qdbusconnection_p.h20
-rw-r--r--src/dbus/qdbusconnectioninterface.cpp8
-rw-r--r--src/dbus/qdbusconnectioninterface.h4
-rw-r--r--src/dbus/qdbusconnectionmanager_p.h2
-rw-r--r--src/dbus/qdbusdemarshaller.cpp2
-rw-r--r--src/dbus/qdbuserror.cpp6
-rw-r--r--src/dbus/qdbusextratypes.cpp18
-rw-r--r--src/dbus/qdbusintegrator.cpp29
-rw-r--r--src/dbus/qdbusintegrator_p.h8
-rw-r--r--src/dbus/qdbusinterface.h8
-rw-r--r--src/dbus/qdbusmessage.cpp16
-rw-r--r--src/dbus/qdbusmetatype.cpp12
-rw-r--r--src/dbus/qdbuspendingcall.cpp2
-rw-r--r--src/dbus/qdbuspendingcall.h4
-rw-r--r--src/dbus/qdbuspendingreply.cpp24
-rw-r--r--src/dbus/qdbuspendingreply.h28
-rw-r--r--src/dbus/qdbusreply.cpp36
-rw-r--r--src/dbus/qdbusreply.h6
-rw-r--r--src/dbus/qdbusserver.cpp2
-rw-r--r--src/dbus/qdbusserver.h4
-rw-r--r--src/dbus/qdbusservicewatcher.h4
-rw-r--r--src/dbus/qdbusthreaddebug_p.h40
-rw-r--r--src/dbus/qdbusvirtualobject.h2
30 files changed, 171 insertions, 192 deletions
diff --git a/src/dbus/qdbusabstractadaptor_p.h b/src/dbus/qdbusabstractadaptor_p.h
index fb185cfb16..023b3b1be2 100644
--- a/src/dbus/qdbusabstractadaptor_p.h
+++ b/src/dbus/qdbusabstractadaptor_p.h
@@ -106,10 +106,6 @@ public: // typedefs
{ return QLatin1String(interface) < other; }
inline bool operator<(const QByteArray &other) const
{ return interface < other; }
-#if defined(Q_CC_MSVC) && _MSC_VER < 1600
- friend inline bool operator<(const QString &str, const AdaptorData &obj)
- { return str < QLatin1String(obj.interface); }
-#endif
};
typedef QVector<AdaptorData> AdaptorMap;
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 9f2e688ebb..7ddf68daa0 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -70,10 +70,10 @@ class DisconnectRelayEvent : public QMetaCallEvent
{
public:
DisconnectRelayEvent(QObject *sender, const QMetaMethod &m)
- : QMetaCallEvent(0, 0, Q_NULLPTR, sender, m.methodIndex())
+ : QMetaCallEvent(0, 0, nullptr, sender, m.methodIndex())
{}
- void placeMetaCall(QObject *object) Q_DECL_OVERRIDE
+ void placeMetaCall(QObject *object) override
{
QDBusAbstractInterface *iface = static_cast<QDBusAbstractInterface *>(object);
QDBusAbstractInterfacePrivate::finishDisconnectNotify(iface, signalId());
@@ -761,27 +761,28 @@ QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &m
switch (count) {
case 8:
argList.prepend(arg8);
- // fall through
+ Q_FALLTHROUGH();
case 7:
argList.prepend(arg7);
- // fall through
+ Q_FALLTHROUGH();
case 6:
argList.prepend(arg6);
- // fall through
+ Q_FALLTHROUGH();
case 5:
argList.prepend(arg5);
- // fall through
+ Q_FALLTHROUGH();
case 4:
argList.prepend(arg4);
- // fall through
+ Q_FALLTHROUGH();
case 3:
argList.prepend(arg3);
- // fall through
+ Q_FALLTHROUGH();
case 2:
argList.prepend(arg2);
- // fall through
+ Q_FALLTHROUGH();
case 1:
argList.prepend(arg1);
+ break;
}
return callWithArgumentList(mode, method, argList);
@@ -826,27 +827,28 @@ QDBusPendingCall QDBusAbstractInterface::asyncCall(const QString &method, const
switch (count) {
case 8:
argList.prepend(arg8);
- // fall through
+ Q_FALLTHROUGH();
case 7:
argList.prepend(arg7);
- // fall through
+ Q_FALLTHROUGH();
case 6:
argList.prepend(arg6);
- // fall through
+ Q_FALLTHROUGH();
case 5:
argList.prepend(arg5);
- // fall through
+ Q_FALLTHROUGH();
case 4:
argList.prepend(arg4);
- // fall through
+ Q_FALLTHROUGH();
case 3:
argList.prepend(arg3);
- // fall through
+ Q_FALLTHROUGH();
case 2:
argList.prepend(arg2);
- // fall through
+ Q_FALLTHROUGH();
case 1:
argList.prepend(arg1);
+ break;
}
return asyncCallWithArgumentList(method, argList);
diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h
index f859c5ee7d..d6b0870787 100644
--- a/src/dbus/qdbusabstractinterface.h
+++ b/src/dbus/qdbusabstractinterface.h
@@ -67,7 +67,7 @@ class QDBusAbstractInterfacePrivate;
class Q_DBUS_EXPORT QDBusAbstractInterfaceBase: public QObject
{
public:
- int qt_metacall(QMetaObject::Call, int, void**) Q_DECL_OVERRIDE;
+ int qt_metacall(QMetaObject::Call, int, void**) override;
protected:
QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent);
private:
@@ -147,8 +147,8 @@ protected:
const QDBusConnection &connection, QObject *parent);
QDBusAbstractInterface(QDBusAbstractInterfacePrivate &, QObject *parent);
- void connectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE;
- void disconnectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE;
+ void connectNotify(const QMetaMethod &signal) override;
+ void disconnectNotify(const QMetaMethod &signal) override;
QVariant internalPropGet(const char *propname) const;
void internalPropSet(const char *propname, const QVariant &value);
QDBusMessage internalConstCall(QDBus::CallMode mode,
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp
index df2817ca77..a33c4f8363 100644
--- a/src/dbus/qdbusargument.cpp
+++ b/src/dbus/qdbusargument.cpp
@@ -267,11 +267,11 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d)
*/
/*!
- \fn qdbus_cast(const QDBusArgument &argument)
+ \fn qdbus_cast(const QDBusArgument &arg)
\relates QDBusArgument
\since 4.2
- Attempts to demarshall the contents of \a argument into the type
+ Attempts to demarshall the contents of \a arg into the type
\c{T}. For example:
\snippet code/src_qdbus_qdbusargument.cpp 2
@@ -1374,6 +1374,12 @@ QDBusArgument &operator<<(QDBusArgument &a, const QLineF &line)
}
#endif
+/*!
+ \fn void QDBusArgument::swap(QDBusArgument &other)
+
+ Swaps this QDBusArgument instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h
index 5342a79227..a6d4e9cd25 100644
--- a/src/dbus/qdbusargument.h
+++ b/src/dbus/qdbusargument.h
@@ -77,7 +77,7 @@ public:
QDBusArgument();
QDBusArgument(const QDBusArgument &other);
#ifdef Q_COMPILER_RVALUE_REFS
- QDBusArgument(QDBusArgument &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
+ QDBusArgument(QDBusArgument &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
QDBusArgument &operator=(QDBusArgument &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDBusArgument &operator=(const QDBusArgument &other);
@@ -160,7 +160,7 @@ QT_BEGIN_NAMESPACE
template<typename T> inline T qdbus_cast(const QDBusArgument &arg
#ifndef Q_QDOC
-, T * = Q_NULLPTR
+, T * = nullptr
#endif
)
{
@@ -171,7 +171,7 @@ template<typename T> inline T qdbus_cast(const QDBusArgument &arg
template<typename T> inline T qdbus_cast(const QVariant &v
#ifndef Q_QDOC
-, T * = Q_NULLPTR
+, T * = nullptr
#endif
)
{
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 75c1e92f96..2c2dfc1ff6 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -147,7 +147,7 @@ QDBusConnectionManager::QDBusConnectionManager()
// prevent the library from being unloaded on Windows. See comments in the function.
preventDllUnload();
#endif
- defaultBuses[0] = defaultBuses[1] = Q_NULLPTR;
+ defaultBuses[0] = defaultBuses[1] = nullptr;
start();
}
@@ -186,13 +186,13 @@ void QDBusConnectionManager::run()
delete d;
} else {
d->closeConnection();
- d->moveToThread(Q_NULLPTR); // allow it to be deleted in another thread
+ d->moveToThread(nullptr); // allow it to be deleted in another thread
}
}
connectionHash.clear();
// allow deletion from any thread without warning
- moveToThread(Q_NULLPTR);
+ moveToThread(nullptr);
}
QDBusConnectionPrivate *QDBusConnectionManager::connectToBus(QDBusConnection::BusType type, const QString &name,
@@ -1175,7 +1175,7 @@ bool QDBusConnection::unregisterService(const QString &serviceName)
QDBusConnection QDBusConnection::sessionBus()
{
if (_q_manager.isDestroyed())
- return QDBusConnection(Q_NULLPTR);
+ return QDBusConnection(nullptr);
return QDBusConnection(_q_manager()->busConnection(SessionBus));
}
@@ -1189,7 +1189,7 @@ QDBusConnection QDBusConnection::sessionBus()
QDBusConnection QDBusConnection::systemBus()
{
if (_q_manager.isDestroyed())
- return QDBusConnection(Q_NULLPTR);
+ return QDBusConnection(nullptr);
return QDBusConnection(_q_manager()->busConnection(SystemBus));
}
@@ -1272,6 +1272,12 @@ QByteArray QDBusConnection::localMachineId()
When using BlockWithGui, applications must be prepared for reentrancy in any function.
*/
+/*!
+ \fn void QDBusConnection::swap(QDBusConnection &other)
+
+ Swaps this QDBusConnection instance with \a other.
+*/
+
QT_END_NAMESPACE
#ifdef Q_OS_WIN
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index f801d6225c..ca7adfaaeb 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -134,7 +134,7 @@ public:
explicit QDBusConnection(const QString &name);
QDBusConnection(const QDBusConnection &other);
#ifdef Q_COMPILER_RVALUE_REFS
- QDBusConnection(QDBusConnection &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
+ QDBusConnection(QDBusConnection &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
QDBusConnection &operator=(QDBusConnection &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDBusConnection &operator=(const QDBusConnection &other);
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index d323088779..444d4727fd 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -59,7 +59,6 @@
#include <QtCore/qatomic.h>
#include <QtCore/qhash.h>
-#include <QtCore/qmutex.h>
#include <QtCore/qobject.h>
#include <QtCore/qpointer.h>
#include <QtCore/qreadwritelock.h>
@@ -149,14 +148,6 @@ public:
{ return name < other; }
inline bool operator<(const QStringRef &other) const
{ return QStringRef(&name) < other; }
-#if defined(Q_CC_MSVC) && _MSC_VER < 1600
- inline bool operator<(const ObjectTreeNode &other) const
- { return name < other.name; }
- friend inline bool operator<(const QString &str, const ObjectTreeNode &obj)
- { return str < obj.name; }
- friend inline bool operator<(const QStringRef &str, const ObjectTreeNode &obj)
- { return str < QStringRef(&obj.name); }
-#endif
inline bool isActive() const
{ return obj || !children.isEmpty(); }
@@ -198,7 +189,6 @@ public:
~QDBusConnectionPrivate();
void createBusService();
- void setDispatchEnabled(bool enable);
void setPeer(DBusConnection *connection, const QDBusErrorInternal &error);
void setConnection(DBusConnection *connection, const QDBusErrorInternal &error);
void setServer(QDBusServer *object, DBusServer *server, const QDBusErrorInternal &error);
@@ -271,10 +261,11 @@ private:
void _q_newConnection(QDBusConnectionPrivate *newConnection);
protected:
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
public slots:
// public slots
+ void setDispatchEnabled(bool enable);
void doDispatch();
void socketRead(int);
void socketWrite(int);
@@ -312,9 +303,6 @@ public:
QDBusServer *serverObject;
};
- // the dispatch lock protects everything related to the DBusConnection or DBusServer
- // including the timeouts and watches
- QMutex dispatchLock;
union {
DBusConnection *connection;
DBusServer *server;
@@ -390,7 +378,9 @@ public:
public slots:
void execute()
{
- con->setDispatchEnabled(true);
+ // This call cannot race with something disabling dispatch only because dispatch is
+ // never re-disabled from Qt code on an in-use connection once it has been enabled.
+ QMetaObject::invokeMethod(con, "setDispatchEnabled", Qt::QueuedConnection, Q_ARG(bool, true));
if (!con->ref.deref())
con->deleteLater();
deleteLater();
diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp
index 2b86eded7f..ebb3803489 100644
--- a/src/dbus/qdbusconnectioninterface.cpp
+++ b/src/dbus/qdbusconnectioninterface.cpp
@@ -378,21 +378,21 @@ void QDBusConnectionInterface::disconnectNotify(const QMetaMethod &signal)
// signals
/*!
- \fn QDBusConnectionInterface::serviceRegistered(const QString &serviceName)
+ \fn QDBusConnectionInterface::serviceRegistered(const QString &service)
This signal is emitted by the D-Bus server when the bus service
name (unique connection name or well-known service name) given by
- \a serviceName is acquired by this application.
+ \a service is acquired by this application.
Acquisition happens after this application has requested a name using
registerService().
*/
/*!
- \fn QDBusConnectionInterface::serviceUnregistered(const QString &serviceName)
+ \fn QDBusConnectionInterface::serviceUnregistered(const QString &service)
This signal is emitted by the D-Bus server when this application
- loses ownership of the bus service name given by \a serviceName.
+ loses ownership of the bus service name given by \a service.
*/
/*!
diff --git a/src/dbus/qdbusconnectioninterface.h b/src/dbus/qdbusconnectioninterface.h
index 37f35dbe81..c7b1573722 100644
--- a/src/dbus/qdbusconnectioninterface.h
+++ b/src/dbus/qdbusconnectioninterface.h
@@ -115,8 +115,8 @@ Q_SIGNALS:
void NameLost(const QString &);
void NameOwnerChanged(const QString &, const QString &, const QString &);
protected:
- void connectNotify(const QMetaMethod &) Q_DECL_OVERRIDE;
- void disconnectNotify(const QMetaMethod &) Q_DECL_OVERRIDE;
+ void connectNotify(const QMetaMethod &) override;
+ void disconnectNotify(const QMetaMethod &) override;
#endif
};
diff --git a/src/dbus/qdbusconnectionmanager_p.h b/src/dbus/qdbusconnectionmanager_p.h
index 1c7dea811d..ac49683cee 100644
--- a/src/dbus/qdbusconnectionmanager_p.h
+++ b/src/dbus/qdbusconnectionmanager_p.h
@@ -85,7 +85,7 @@ signals:
void serverRequested(const QString &address, void *server);
protected:
- void run() Q_DECL_OVERRIDE;
+ void run() override;
private:
void executeConnectionRequest(ConnectionRequestData *data);
diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp
index 57684897c6..6befb33d61 100644
--- a/src/dbus/qdbusdemarshaller.cpp
+++ b/src/dbus/qdbusdemarshaller.cpp
@@ -289,7 +289,7 @@ QVariant QDBusDemarshaller::toVariantInternal()
case DBUS_TYPE_UNIX_FD:
if (capabilities & QDBusConnection::UnixFileDescriptorPassing)
return QVariant::fromValue(toUnixFileDescriptor());
- // fall through
+ Q_FALLTHROUGH();
default:
// qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'",
diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp
index c599df6a32..e966f9dcde 100644
--- a/src/dbus/qdbuserror.cpp
+++ b/src/dbus/qdbuserror.cpp
@@ -409,6 +409,12 @@ QDebug operator<<(QDebug dbg, const QDBusError &msg)
}
#endif
+/*!
+ \fn void QDBusError::swap(QDBusError &other)
+
+ Swaps this QDBusError instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusextratypes.cpp b/src/dbus/qdbusextratypes.cpp
index 964daac6d9..a0b121a1a3 100644
--- a/src/dbus/qdbusextratypes.cpp
+++ b/src/dbus/qdbusextratypes.cpp
@@ -218,6 +218,24 @@ void QDBusSignature::doCheck()
\sa signature()
*/
+/*!
+ \fn void QDBusObjectPath::swap(QDBusObjectPath &other)
+
+ Swaps this QDBusObjectPath instance with \a other.
+*/
+
+/*!
+ \fn void QDBusSignature::swap(QDBusSignature &other)
+
+ Swaps this QDBusSignature instance with \a other.
+*/
+
+/*!
+ \fn void QDBusVariant::swap(QDBusVariant &other)
+
+ Swaps this QDBusVariant instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 16cd021d0d..03de5b0091 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -150,7 +150,6 @@ static dbus_bool_t qDBusAddTimeout(DBusTimeout *timeout, void *data)
if (Q_UNLIKELY(!q_dbus_timeout_get_enabled(timeout)))
return false;
- QDBusDispatchLocker locker(AddTimeoutAction, d);
Q_ASSERT(d->timeouts.key(timeout, 0) == 0);
int timerId = d->startTimer(q_dbus_timeout_get_interval(timeout));
@@ -172,8 +171,6 @@ static void qDBusRemoveTimeout(DBusTimeout *timeout, void *data)
QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data);
Q_ASSERT(QThread::currentThread() == d->thread());
- QDBusDispatchLocker locker(RemoveTimeoutAction, d);
-
QDBusConnectionPrivate::TimeoutHash::iterator it = d->timeouts.begin();
while (it != d->timeouts.end()) {
if (it.value() == timeout) {
@@ -210,7 +207,6 @@ static dbus_bool_t qDBusAddWatch(DBusWatch *watch, void *data)
QDBusConnectionPrivate::Watcher watcher;
- QDBusDispatchLocker locker(AddWatchAction, d);
if (flags & DBUS_WATCH_READABLE) {
//qDebug("addReadWatch %d", fd);
watcher.watch = watch;
@@ -241,7 +237,6 @@ static void qDBusRemoveWatch(DBusWatch *watch, void *data)
Q_ASSERT(QThread::currentThread() == d->thread());
int fd = q_dbus_watch_get_unix_fd(watch);
- QDBusDispatchLocker locker(RemoveWatchAction, d);
QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd);
while (i != d->watchers.end() && i.key() == fd) {
if (i.value().watch == watch) {
@@ -263,8 +258,6 @@ static void qDBusToggleWatch(DBusWatch *watch, void *data)
Q_ASSERT(QThread::currentThread() == d->thread());
int fd = q_dbus_watch_get_unix_fd(watch);
- QDBusDispatchLocker locker(ToggleWatchAction, d);
-
QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd);
while (i != d->watchers.end() && i.key() == fd) {
if (i.value().watch == watch) {
@@ -766,7 +759,7 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
*/
void QDBusConnectionPrivate::setDispatchEnabled(bool enable)
{
- QDBusDispatchLocker locker(SetDispatchEnabledAction, this);
+ checkThread();
dispatchEnabled = enable;
if (enable)
emit dispatchStatusChanged();
@@ -1024,7 +1017,7 @@ extern bool qDBusInitThreads();
QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
: QObject(p), ref(1), capabilities(0), mode(InvalidMode), busService(0),
- dispatchLock(QMutex::Recursive), connection(0),
+ connection(0),
rootNode(QString(QLatin1Char('/'))),
anonymousAuthenticationAllowed(false),
dispatchEnabled(true)
@@ -1078,7 +1071,7 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
Q_ASSERT(ref.load() == 0);
QObject *obj = (QObject *)busService;
if (obj) {
- disconnect(obj, Q_NULLPTR, this, Q_NULLPTR);
+ disconnect(obj, nullptr, this, nullptr);
delete obj;
}
if (connection)
@@ -1176,7 +1169,6 @@ bool QDBusConnectionPrivate::handleError(const QDBusErrorInternal &error)
void QDBusConnectionPrivate::timerEvent(QTimerEvent *e)
{
{
- QDBusDispatchLocker locker(TimerEventAction, this);
DBusTimeout *timeout = timeouts.value(e->timerId(), 0);
if (timeout)
q_dbus_timeout_handle(timeout);
@@ -1187,7 +1179,6 @@ void QDBusConnectionPrivate::timerEvent(QTimerEvent *e)
void QDBusConnectionPrivate::doDispatch()
{
- QDBusDispatchLocker locker(DoDispatchAction, this);
if (mode == ClientMode || mode == PeerMode) {
while (q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS) ;
if (dispatchEnabled && !pendingMessages.isEmpty()) {
@@ -1205,7 +1196,6 @@ void QDBusConnectionPrivate::doDispatch()
void QDBusConnectionPrivate::socketRead(int fd)
{
- QDBusDispatchLocker locker(SocketReadAction, this);
WatcherHash::ConstIterator it = watchers.constFind(fd);
while (it != watchers.constEnd() && it.key() == fd) {
if (it->watch && it->read && it->read->isEnabled()) {
@@ -1220,7 +1210,6 @@ void QDBusConnectionPrivate::socketRead(int fd)
void QDBusConnectionPrivate::socketWrite(int fd)
{
- QDBusDispatchLocker locker(SocketWriteAction, this);
WatcherHash::ConstIterator it = watchers.constFind(fd);
while (it != watchers.constEnd() && it.key() == fd) {
if (it->watch && it->write && it->write->isEnabled()) {
@@ -1283,10 +1272,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
//qDBusDebug() << "Emitting signal" << message;
//qDBusDebug() << "for paths:";
q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything
- {
- QDBusDispatchLocker locker(HuntAndEmitAction, this);
- huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor);
- }
+ huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor);
q_dbus_message_unref(msg);
}
@@ -1950,7 +1936,7 @@ bool QDBusConnectionPrivate::send(const QDBusMessage& message)
q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything
qDBusDebug() << this << "sending message (no reply):" << message;
- emit messageNeedsSending(Q_NULLPTR, msg);
+ emit messageNeedsSending(nullptr, msg);
return true;
}
@@ -2164,9 +2150,8 @@ void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *
Q_ASSERT(isNoReply == !!q_dbus_message_get_no_reply(msg));
checkThread();
- QDBusDispatchLocker locker(SendMessageAction, this);
- if (isNoReply && q_dbus_connection_send(connection, msg, Q_NULLPTR)) {
+ if (isNoReply && q_dbus_connection_send(connection, msg, nullptr)) {
// success
} else if (!isNoReply && q_dbus_connection_send_with_reply(connection, msg, &pending, timeout)) {
if (pending) {
@@ -2509,7 +2494,7 @@ QString QDBusConnectionPrivate::getNameOwnerNoCache(const QString &serviceName)
QDBusMessagePrivate::setParametersValidated(msg, true);
msg << serviceName;
- QDBusPendingCallPrivate *pcall = sendWithReplyAsync(msg, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR);
+ QDBusPendingCallPrivate *pcall = sendWithReplyAsync(msg, nullptr, nullptr, nullptr);
if (thread() == QThread::currentThread()) {
// this function may be called in our own thread and
// QDBusPendingCallPrivate::waitForFinished() would deadlock there
diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
index 85a067da1e..3cd029a933 100644
--- a/src/dbus/qdbusintegrator_p.h
+++ b/src/dbus/qdbusintegrator_p.h
@@ -109,7 +109,7 @@ public:
: QMetaCallEvent(0, id, 0, sender, -1), connection(c), message(msg), metaTypes(types), flags(f)
{ }
- void placeMetaCall(QObject *object) Q_DECL_OVERRIDE
+ void placeMetaCall(QObject *object) override
{
QDBusConnectionPrivate::d(connection)->deliverCall(object, flags, message, metaTypes, id());
}
@@ -132,7 +132,7 @@ public:
{ }
~QDBusActivateObjectEvent();
- void placeMetaCall(QObject *) Q_DECL_OVERRIDE;
+ void placeMetaCall(QObject *) override;
private:
QDBusConnection connection; // just for refcounting
@@ -148,10 +148,10 @@ public:
typedef void (*Hook)(const QDBusMessage&);
QDBusSpyCallEvent(QDBusConnectionPrivate *cp, const QDBusConnection &c, const QDBusMessage &msg,
const Hook *hooks, int count)
- : QMetaCallEvent(0, 0, Q_NULLPTR, cp, 0), conn(c), msg(msg), hooks(hooks), hookCount(count)
+ : QMetaCallEvent(0, 0, nullptr, cp, 0), conn(c), msg(msg), hooks(hooks), hookCount(count)
{}
~QDBusSpyCallEvent();
- void placeMetaCall(QObject *) Q_DECL_OVERRIDE;
+ void placeMetaCall(QObject *) override;
static inline void invokeSpyHooks(const QDBusMessage &msg, const Hook *hooks, int hookCount);
QDBusConnection conn; // keeps the refcount in QDBusConnectionPrivate up
diff --git a/src/dbus/qdbusinterface.h b/src/dbus/qdbusinterface.h
index b6c2693400..c147d07d50 100644
--- a/src/dbus/qdbusinterface.h
+++ b/src/dbus/qdbusinterface.h
@@ -59,12 +59,12 @@ private:
public:
QDBusInterface(const QString &service, const QString &path, const QString &interface = QString(),
const QDBusConnection &connection = QDBusConnection::sessionBus(),
- QObject *parent = Q_NULLPTR);
+ QObject *parent = nullptr);
~QDBusInterface();
- virtual const QMetaObject *metaObject() const Q_DECL_OVERRIDE;
- virtual void *qt_metacast(const char *) Q_DECL_OVERRIDE;
- virtual int qt_metacall(QMetaObject::Call, int, void **) Q_DECL_OVERRIDE;
+ virtual const QMetaObject *metaObject() const override;
+ virtual void *qt_metacast(const char *) override;
+ virtual int qt_metacall(QMetaObject::Call, int, void **) override;
private:
Q_DECLARE_PRIVATE(QDBusInterface)
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 28d832c7c2..ef827e82b0 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -777,16 +777,6 @@ QDBusMessage::MessageType QDBusMessage::type() const
return InvalidMessage;
}
-/*!
- Sends the message without waiting for a reply. This is suitable
- for errors, signals, and return values as well as calls whose
- return values are not necessary.
-
- Returns \c true if the message was queued successfully;
- otherwise returns \c false.
-
- \sa QDBusConnection::send()
-*/
#ifndef QT_NO_DEBUG_STREAM
static QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t)
{
@@ -839,6 +829,12 @@ QDebug operator<<(QDebug dbg, const QDBusMessage &msg)
}
#endif
+/*!
+ \fn void QDBusMessage::swap(QDBusMessage &other)
+
+ Swaps this QDBusMessage instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
index 6ed6c43e9d..0729a3cbbb 100644
--- a/src/dbus/qdbusmetatype.cpp
+++ b/src/dbus/qdbusmetatype.cpp
@@ -131,6 +131,18 @@ void QDBusMetaTypeId::init()
qDBusRegisterMetaType<QList<QDBusObjectPath> >();
qDBusRegisterMetaType<QList<QDBusSignature> >();
qDBusRegisterMetaType<QList<QDBusUnixFileDescriptor> >();
+
+ qDBusRegisterMetaType<QVector<bool> >();
+ qDBusRegisterMetaType<QVector<short> >();
+ qDBusRegisterMetaType<QVector<ushort> >();
+ qDBusRegisterMetaType<QVector<int> >();
+ qDBusRegisterMetaType<QVector<uint> >();
+ qDBusRegisterMetaType<QVector<qlonglong> >();
+ qDBusRegisterMetaType<QVector<qulonglong> >();
+ qDBusRegisterMetaType<QVector<double> >();
+ qDBusRegisterMetaType<QVector<QDBusObjectPath> >();
+ qDBusRegisterMetaType<QVector<QDBusSignature> >();
+ qDBusRegisterMetaType<QVector<QDBusUnixFileDescriptor> >();
#endif
initialized.store(true);
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 6cc76946ac..bd6eb9eca3 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -414,7 +414,7 @@ QDBusMessage QDBusPendingCall::reply() const
}
#if 0
-/*!
+/*
Sets the slot \a member in object \a target to be called when the
reply arrives. The slot's parameter list must match the reply
message's arguments for it to be called.
diff --git a/src/dbus/qdbuspendingcall.h b/src/dbus/qdbuspendingcall.h
index 1e4c6ebfd2..ec8ba6c541 100644
--- a/src/dbus/qdbuspendingcall.h
+++ b/src/dbus/qdbuspendingcall.h
@@ -100,7 +100,7 @@ class Q_DBUS_EXPORT QDBusPendingCallWatcher: public QObject, public QDBusPending
{
Q_OBJECT
public:
- explicit QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent = Q_NULLPTR);
+ explicit QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent = nullptr);
~QDBusPendingCallWatcher();
#ifdef Q_QDOC
@@ -110,7 +110,7 @@ public:
void waitForFinished(); // non-virtual override
Q_SIGNALS:
- void finished(QDBusPendingCallWatcher *self = Q_NULLPTR);
+ void finished(QDBusPendingCallWatcher *self = nullptr);
private:
Q_DECLARE_PRIVATE(QDBusPendingCallWatcher)
diff --git a/src/dbus/qdbuspendingreply.cpp b/src/dbus/qdbuspendingreply.cpp
index f1489ed720..c0baa4a005 100644
--- a/src/dbus/qdbuspendingreply.cpp
+++ b/src/dbus/qdbuspendingreply.cpp
@@ -165,6 +165,12 @@
*/
/*!
+ \enum QDBusPendingReply::anonymous
+
+ \value Count The number of arguments the reply is expected to have
+ */
+
+/*!
\fn int QDBusPendingReply::count() const
Return the number of arguments the reply is supposed to have. This
@@ -192,21 +198,9 @@
*/
/*!
- \fn Type QDBusPendingReply::argumentAt() const
-
- Returns the argument at position \c Index (which is a template
- parameter) cast to type \c Type. This function uses template code
- to determine the proper \c Type type, according to the type list
- used in the construction of this object.
-
- Note that, if the reply hasn't arrived, this function causes the
- calling thread to block until the reply is processed.
-
- If the reply does not contain an argument at position \c Index or if the
- reply was an error, this function returns a \c Type object that is default
- constructed, which may be indistinguishable from a valid value. To reliably
- determine whether the message was an error, use isError().
-*/
+ \typedef QDBusPendingReply::T1
+ \internal
+ */
/*!
\fn T1 QDBusPendingReply::value() const
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index da29894d15..4d2c3a7c5a 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -108,10 +108,12 @@ namespace QDBusPendingReplyTypes {
template <> struct NotVoid<void> { typedef TypeIsVoid Type; };
} // namespace QDBusPendingReplyTypes
+#ifndef Q_CLANG_QDOC
template<typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void,
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void>
+#endif
class QDBusPendingReply:
-#ifdef Q_QDOC
+#ifdef Q_CLANG_QDOC
public QDBusPendingCall
#else
public QDBusPendingReplyData
@@ -144,13 +146,23 @@ public:
inline int count() const { return Count; }
-#if defined(Q_QDOC)
+#if defined(Q_CLANG_QDOC)
QVariant argumentAt(int index) const;
#else
using QDBusPendingReplyData::argumentAt;
#endif
-#if defined(Q_QDOC)
+#ifndef Q_CLANG_QDOC
+ template<int Index> inline
+ const typename Select<Index>::Type argumentAt() const
+ {
+ Q_STATIC_ASSERT_X(Index >= 0 && Index < Count, "Index out of bounds");
+ typedef typename Select<Index>::Type ResultType;
+ return qdbus_cast<ResultType>(argumentAt(Index), 0);
+ }
+#endif
+
+#if defined(Q_CLANG_QDOC)
bool isFinished() const;
void waitForFinished();
@@ -159,18 +171,10 @@ public:
QDBusError error() const;
QDBusMessage reply() const;
- template<int Index> inline Type argumentAt() const;
+ typedef QVariant T1;
inline T1 value() const;
inline operator T1() const;
#else
- template<int Index> inline
- const typename Select<Index>::Type argumentAt() const
- {
- Q_STATIC_ASSERT_X(Index >= 0 && Index < Count, "Index out of bounds");
- typedef typename Select<Index>::Type ResultType;
- return qdbus_cast<ResultType>(argumentAt(Index), 0);
- }
-
inline typename Select<0>::Type value() const
{
return argumentAt<0>();
diff --git a/src/dbus/qdbusreply.cpp b/src/dbus/qdbusreply.cpp
index aefbb4f9a2..ab361f1674 100644
--- a/src/dbus/qdbusreply.cpp
+++ b/src/dbus/qdbusreply.cpp
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
If the remote method call cannot fail, you can skip the error checking:
\snippet code/src_qdbus_qdbusreply.cpp 1
- However, if it does fail under those conditions, the value returned by QDBusReply::value() is
+ However, if it does fail under those conditions, the value returned by QDBusReply<T>::value() is
a default-constructed value. It may be indistinguishable from a valid return value.
QDBusReply objects are used for remote calls that have no output
@@ -75,18 +75,18 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QDBusReply::QDBusReply(const QDBusMessage &reply)
+ \fn template<typename T> QDBusReply<T>::QDBusReply(const QDBusMessage &reply)
Automatically construct a QDBusReply object from the reply message \a reply, extracting the
first return value from it if it is a success reply.
*/
/*!
- \fn QDBusReply::QDBusReply(const QDBusPendingReply<T> &reply)
+ \fn template<typename T> QDBusReply<T>::QDBusReply(const QDBusPendingReply &reply)
Constructs a QDBusReply object from the pending reply message, \a reply.
*/
/*!
- \fn QDBusReply::QDBusReply(const QDBusPendingCall &pcall)
+ \fn template <typename T> QDBusReply<T>::QDBusReply(const QDBusPendingCall &pcall)
Automatically construct a QDBusReply object from the asynchronous
pending call \a pcall. If the call isn't finished yet, QDBusReply
will call QDBusPendingCall::waitForFinished(), which is a blocking
@@ -97,29 +97,29 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QDBusReply::QDBusReply(const QDBusError &error)
+ \fn template <typename T> QDBusReply<T>::QDBusReply(const QDBusError &error)
Constructs an error reply from the D-Bus error code given by \a error.
*/
/*!
- \fn QDBusReply::operator=(const QDBusReply &other)
+ \fn template <typename T> QDBusReply<T>::operator=(const QDBusReply &other)
Makes this object be a copy of the object \a other.
*/
/*!
- \fn QDBusReply::operator=(const QDBusError &error)
- Sets this object to contain the error code given by \a error. You
+ \fn template <typename T> QDBusReply<T>::operator=(const QDBusError &dbusError)
+ Sets this object to contain the error code given by \a dbusError. You
can later access it with error().
*/
/*!
- \fn QDBusReply::operator=(const QDBusMessage &message)
+ \fn template <typename T> QDBusReply<T>::operator=(const QDBusMessage &reply)
- Makes this object contain the reply specified by message \a
- message. If \a message is an error message, this function will
+ Makes this object contain the \a reply message. If \a reply
+ is an error message, this function will
copy the error code and message into this object
- If \a message is a standard reply message and contains at least
+ If \a reply is a standard reply message and contains at least
one parameter, it will be copied into this object, as long as it
is of the correct type. If it's not of the same type as this
QDBusError object, this function will instead set an error code
@@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QDBusReply::operator=(const QDBusPendingCall &pcall)
+ \fn template <typename T> QDBusReply<T>::operator=(const QDBusPendingCall &pcall)
Makes this object contain the reply specified by the pending
asynchronous call \a pcall. If the call is not finished yet, this
@@ -145,7 +145,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool QDBusReply::isValid() const
+ \fn template <typename T> bool QDBusReply<T>::isValid() const
Returns \c true if no error occurred; otherwise, returns \c false.
@@ -153,7 +153,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const QDBusError& QDBusReply::error() const
+ \fn template<typename T> const QDBusError& QDBusReply<T>::error() const
Returns the error code that was returned from the remote function call. If the remote call did
not return an error (i.e., if it succeeded), then the QDBusError object that is returned will
@@ -163,12 +163,12 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const QDBusError& QDBusReply::error()
+ \fn template <typename T> const QDBusError& QDBusReply<T>::error()
\overload
*/
/*!
- \fn QDBusReply::value() const
+ \fn template <typename T> QDBusReply<T>::value() const
Returns the remote function's calls return value. If the remote call returned with an error,
the return value of this function is undefined and may be undistinguishable from a valid return
value.
@@ -177,7 +177,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QDBusReply::operator Type() const
+ \fn template <typename T> QDBusReply<T>::operator Type() const
Returns the same as value().
This function is not available if the remote call returns \c void.
diff --git a/src/dbus/qdbusreply.h b/src/dbus/qdbusreply.h
index 227615024a..177b6c6e89 100644
--- a/src/dbus/qdbusreply.h
+++ b/src/dbus/qdbusreply.h
@@ -82,10 +82,14 @@ public:
other.waitForFinished();
return *this = other.reply();
}
+#if defined(Q_CLANG_QDOC)
+ inline QDBusReply(const QDBusPendingReply &reply) { }
+#else
inline QDBusReply(const QDBusPendingReply<T> &reply)
{
*this = static_cast<QDBusPendingCall>(reply);
}
+#endif
inline QDBusReply(const QDBusError &dbusError = QDBusError())
: m_error(dbusError), m_data(Type())
@@ -130,7 +134,7 @@ private:
template<> inline QDBusReply<QVariant>&
QDBusReply<QVariant>::operator=(const QDBusMessage &reply)
{
- void *null = Q_NULLPTR;
+ void *null = nullptr;
QVariant data(qMetaTypeId<QDBusVariant>(), null);
qDBusReplyFill(reply, m_error, data);
m_data = qvariant_cast<QDBusVariant>(data).variant();
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index ce55297abb..a2dfb86164 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -116,7 +116,7 @@ QDBusServer::~QDBusServer()
QDBusConnectionManager::instance()->removeConnection(name);
d->serverConnectionNames.clear();
}
- d->serverObject = Q_NULLPTR;
+ d->serverObject = nullptr;
d->ref.store(0);
d->deleteLater();
}
diff --git a/src/dbus/qdbusserver.h b/src/dbus/qdbusserver.h
index ac4dfcb67f..668b8705b1 100644
--- a/src/dbus/qdbusserver.h
+++ b/src/dbus/qdbusserver.h
@@ -57,8 +57,8 @@ class Q_DBUS_EXPORT QDBusServer: public QObject
{
Q_OBJECT
public:
- explicit QDBusServer(const QString &address, QObject *parent = Q_NULLPTR);
- explicit QDBusServer(QObject *parent = Q_NULLPTR);
+ explicit QDBusServer(const QString &address, QObject *parent = nullptr);
+ explicit QDBusServer(QObject *parent = nullptr);
virtual ~QDBusServer();
bool isConnected() const;
diff --git a/src/dbus/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h
index 77573beb5d..2c45c85cb9 100644
--- a/src/dbus/qdbusservicewatcher.h
+++ b/src/dbus/qdbusservicewatcher.h
@@ -64,9 +64,9 @@ public:
Q_DECLARE_FLAGS(WatchMode, WatchModeFlag)
Q_FLAG(WatchMode)
- explicit QDBusServiceWatcher(QObject *parent = Q_NULLPTR);
+ explicit QDBusServiceWatcher(QObject *parent = nullptr);
QDBusServiceWatcher(const QString &service, const QDBusConnection &connection,
- WatchMode watchMode = WatchForOwnerChange, QObject *parent = Q_NULLPTR);
+ WatchMode watchMode = WatchForOwnerChange, QObject *parent = nullptr);
~QDBusServiceWatcher();
QStringList watchedServices() const;
diff --git a/src/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h
index 96f389fa49..ad0984e26c 100644
--- a/src/dbus/qdbusthreaddebug_p.h
+++ b/src/dbus/qdbusthreaddebug_p.h
@@ -95,17 +95,6 @@ enum ThreadAction {
PendingCallBlockAction = 28,
SendMessageAction = 29,
HuntAndEmitAction = 30,
-
- AddTimeoutAction = 50,
- RealAddTimeoutAction = 51,
- RemoveTimeoutAction = 52,
- KillTimerAction = 58,
- TimerEventAction = 59,
- AddWatchAction = 60,
- RemoveWatchAction = 61,
- ToggleWatchAction = 62,
- SocketReadAction = 63,
- SocketWriteAction = 64
};
struct QDBusLockerBase
@@ -176,35 +165,6 @@ struct QDBusWriteLocker: QDBusLockerBase
}
};
-struct QDBusMutexLocker: QDBusLockerBase
-{
- QDBusConnectionPrivate *self;
- QMutex *mutex;
- ThreadAction action;
- inline QDBusMutexLocker(ThreadAction a, QDBusConnectionPrivate *s,
- QMutex *m)
- : self(s), mutex(m), action(a)
- {
- reportThreadAction(action, BeforeLock, self);
- mutex->lock();
- reportThreadAction(action, AfterLock, self);
- }
-
- inline ~QDBusMutexLocker()
- {
- reportThreadAction(action, BeforeUnlock, self);
- mutex->unlock();
- reportThreadAction(action, AfterUnlock, self);
- }
-};
-
-struct QDBusDispatchLocker: QDBusMutexLocker
-{
- inline QDBusDispatchLocker(ThreadAction a, QDBusConnectionPrivate *s)
- : QDBusMutexLocker(a, s, &s->dispatchLock)
- { }
-};
-
#if QDBUS_THREAD_DEBUG
# define SEM_ACQUIRE(action, sem) \
do { \
diff --git a/src/dbus/qdbusvirtualobject.h b/src/dbus/qdbusvirtualobject.h
index 1a96d900b4..b69e21b378 100644
--- a/src/dbus/qdbusvirtualobject.h
+++ b/src/dbus/qdbusvirtualobject.h
@@ -56,7 +56,7 @@ class Q_DBUS_EXPORT QDBusVirtualObject : public QObject
{
Q_OBJECT
public:
- explicit QDBusVirtualObject(QObject *parent = Q_NULLPTR);
+ explicit QDBusVirtualObject(QObject *parent = nullptr);
virtual ~QDBusVirtualObject();
virtual QString introspect(const QString &path) const = 0;