summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusintegrator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r--src/dbus/qdbusintegrator.cpp29
1 files changed, 7 insertions, 22 deletions
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