OSDN Git Service

disable automatic async D-Bus calls code due to thread-safety issues
authorIvailo Monev <xakepa10@gmail.com>
Mon, 21 Jun 2021 17:11:51 +0000 (20:11 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 21 Jun 2021 17:11:51 +0000 (20:11 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
README
src/dbus/qdbusabstractinterface.cpp
src/dbus/qdbusconnection.cpp

diff --git a/README b/README
index a4db30a..9fcf615 100644 (file)
--- a/README
+++ b/README
@@ -64,7 +64,6 @@ There are several things you should be aware before considering Katie:
   - stack backtrace on assert, crash or warning via execinfo
   - brief manual pages for all command-line tools
   - desktop files, Shell profile and dynamic linker/loader config
-  - automatic async D-Bus calls based on return type, no Q_NOREPLY needed
   - more reliable qrand(), seeded per thread
   - improved signal/slot template arguments handling
   - improved OpenSSL default certificate and certificates directory detection
index e9f3691..089b654 100644 (file)
@@ -419,6 +419,8 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
     if (mode == QDBus::AutoDetect) {
         // determine if this a sync or async call
         mode = QDBus::Block;
+        // not thread-safe, slots/methods have to be annotated from interface generator too
+#if 0
         const QMetaObject *mo = metaObject();
         const QByteArray match = m.toLatin1() + '(';
 
@@ -440,6 +442,7 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
                 }
             }
         }
+#endif
     }
 
 //    qDebug() << "QDBusAbstractInterface" << "Service" << service() << "Path:" << path();
index 2b2b2e8..ff1b6a0 100644 (file)
@@ -542,7 +542,13 @@ QDBusMessage QDBusConnection::call(const QDBusMessage &message, QDBus::CallMode
         return QDBusMessage::createError(err);
     }
 
-    return d->sendWithReply(message, mode, timeout);
+    if (mode != QDBus::NoBlock)
+        return d->sendWithReply(message, mode, timeout);
+
+    d->send(message);
+    QDBusMessage retval;
+    retval << QVariant(); // add one argument (to avoid .at(0) problems)
+    return retval;
 }
 
 /*!