summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp38
-rw-r--r--src/dbus/qdbusargument.cpp8
-rw-r--r--src/dbus/qdbusargument_p.h10
-rw-r--r--src/dbus/qdbusconnection.cpp50
-rw-r--r--src/dbus/qdbusconnection.h9
-rw-r--r--src/dbus/qdbusconnection_p.h1
-rw-r--r--src/dbus/qdbusdemarshaller.cpp8
-rw-r--r--src/dbus/qdbusintegrator.cpp16
-rw-r--r--src/dbus/qdbusmarshaller.cpp11
-rw-r--r--src/dbus/qdbusmessage.cpp17
-rw-r--r--src/dbus/qdbusmessage_p.h6
11 files changed, 117 insertions, 57 deletions
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 4497b8c..053b3d2 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -173,6 +173,7 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
int invalidCount = 0;
int remainingCount = 0;
char *remainingBuffer = 0;
+ IconvState *temporaryState = 0;
IconvState **pstate;
if (convState) {
@@ -193,11 +194,11 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
// we're running after the Q_GLOBAL_STATIC has been deleted
// or before the QCoreApplication initialization
// bad programmer, no cookie for you
- return QString::fromLatin1(chars, len);
+ pstate = &temporaryState;
+ } else {
+ // stateless conversion -- use thread-local data
+ pstate = &toUnicodeState()->localData();
}
-
- // stateless conversion -- use thread-local data
- pstate = &toUnicodeState()->localData();
}
if (!*pstate) {
@@ -280,6 +281,7 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
}
+ delete temporaryState;
return QString::fromLatin1(chars, len);
}
} while (inBytesLeft != 0);
@@ -294,6 +296,7 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
}
+ delete temporaryState;
return s;
}
@@ -337,30 +340,22 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
char **inBytesPtr = &inBytes;
#endif
+ IconvState *temporaryState = 0;
QThreadStorage<QIconvCodec::IconvState *> *ts = fromUnicodeState();
- if (!qt_locale_initialized || !ts) {
- // we're running after the Q_GLOBAL_STATIC has been deleted
- // or before the QCoreApplication initialization
- // bad programmer, no cookie for you
- if (!len)
- // this is a special case - zero-sized string should be
- // translated to empty but not-null QByteArray.
- return QByteArray("");
- return QString::fromRawData(uc, len).toLatin1();
- }
- IconvState *&state = ts->localData();
+ IconvState *&state = (qt_locale_initialized && ts) ? ts->localData() : temporaryState;
if (!state) {
- state = new IconvState(QIconvCodec::createIconv_t(0, UTF16));
- if (state->cd == reinterpret_cast<iconv_t>(-1)) {
- if (!setByteOrder(state->cd)) {
+ iconv_t cd = QIconvCodec::createIconv_t(0, UTF16);
+ if (cd != reinterpret_cast<iconv_t>(-1)) {
+ if (!setByteOrder(cd)) {
perror("QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed for BOM");
- iconv_close(state->cd);
- state->cd = reinterpret_cast<iconv_t>(-1);
+ iconv_close(cd);
+ cd = reinterpret_cast<iconv_t>(-1);
return QString(uc, len).toLatin1();
}
}
+ state = new IconvState(cd);
}
if (state->cd == reinterpret_cast<iconv_t>(-1)) {
static int reported = 0;
@@ -368,6 +363,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
fprintf(stderr,
"QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed\n");
}
+ delete temporaryState;
return QString(uc, len).toLatin1();
}
@@ -430,6 +426,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
// reset to initial state
iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
+ delete temporaryState;
return QString(uc, len).toLatin1();
}
}
@@ -445,6 +442,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
if (convState)
convState->invalidChars = invalidCount;
+ delete temporaryState;
return ba;
}
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp
index 00f49ba..09f0e82 100644
--- a/src/dbus/qdbusargument.cpp
+++ b/src/dbus/qdbusargument.cpp
@@ -72,7 +72,7 @@ QByteArray QDBusArgumentPrivate::createSignature(int id)
return "";
QByteArray signature;
- QDBusMarshaller *marshaller = new QDBusMarshaller;
+ QDBusMarshaller *marshaller = new QDBusMarshaller(0);
marshaller->ba = &signature;
// run it
@@ -114,7 +114,7 @@ bool QDBusArgumentPrivate::checkWrite(QDBusArgumentPrivate *&d)
return false;
if (d->message && d->ref != 1) {
- QDBusMarshaller *dd = new QDBusMarshaller;
+ QDBusMarshaller *dd = new QDBusMarshaller(d->capabilities);
dd->message = q_dbus_message_copy(d->message);
q_dbus_message_iter_init_append(dd->message, &dd->iterator);
@@ -157,7 +157,7 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d)
if (d->ref == 1)
return true; // no need to detach
- QDBusDemarshaller *dd = new QDBusDemarshaller;
+ QDBusDemarshaller *dd = new QDBusDemarshaller(d->capabilities);
dd->message = q_dbus_message_ref(d->message);
dd->iterator = static_cast<QDBusDemarshaller*>(d)->iterator;
@@ -295,7 +295,7 @@ QDBusArgument::QDBusArgument()
return;
}
- QDBusMarshaller *dd = new QDBusMarshaller;
+ QDBusMarshaller *dd = new QDBusMarshaller(0);
d = dd;
// create a new message with any type, we won't sent it anyways
diff --git a/src/dbus/qdbusargument_p.h b/src/dbus/qdbusargument_p.h
index fe3a9cd..89a383f 100644
--- a/src/dbus/qdbusargument_p.h
+++ b/src/dbus/qdbusargument_p.h
@@ -65,8 +65,8 @@ class QDBusDemarshaller;
class QDBusArgumentPrivate
{
public:
- inline QDBusArgumentPrivate()
- : message(0), ref(1)
+ inline QDBusArgumentPrivate(int flags = 0)
+ : message(0), ref(1), capabilities(flags)
{ }
~QDBusArgumentPrivate();
@@ -89,6 +89,7 @@ public:
public:
DBusMessage *message;
QAtomicInt ref;
+ int capabilities;
enum Direction {
Marshalling,
Demarshalling
@@ -98,7 +99,7 @@ public:
class QDBusMarshaller: public QDBusArgumentPrivate
{
public:
- QDBusMarshaller() : parent(0), ba(0), closeCode(0), ok(true)
+ QDBusMarshaller(int flags) : QDBusArgumentPrivate(flags), parent(0), ba(0), closeCode(0), ok(true)
{ direction = Marshalling; }
~QDBusMarshaller();
@@ -153,7 +154,8 @@ private:
class QDBusDemarshaller: public QDBusArgumentPrivate
{
public:
- inline QDBusDemarshaller() : parent(0) { direction = Demarshalling; }
+ inline QDBusDemarshaller(int flags) : QDBusArgumentPrivate(flags), parent(0)
+ { direction = Demarshalling; }
~QDBusDemarshaller();
QString currentSignature();
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 3fb63eb..4883a4d 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -42,6 +42,7 @@
#include <qdebug.h>
#include <qcoreapplication.h>
#include <qstringlist.h>
+#include <qthread.h>
#include "qdbusconnection.h"
#include "qdbusconnectioninterface.h"
@@ -247,6 +248,17 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP
*/
/*!
+ \since 4.8
+ \enum QDBusConnection::ConnectionCapabilities
+ The available capabilities for a D-Bus connection.
+
+ \value UnixFileDescriptorPassing passing of Unix file descriptors to other processes
+ (see QDBusUnixFileDescriptor)
+
+ \sa connectionCapabilities()
+*/
+
+/*!
Creates a QDBusConnection object attached to the connection with name \a name.
This does not open the connection. You have to call connectToBus() to open it.
@@ -873,6 +885,21 @@ QDBusConnectionInterface *QDBusConnection::interface() const
}
/*!
+ \internal
+ \since 4.8
+
+ Returns the internal, implementation-defined pointer for this
+ connection. Currently, this returns a DBusConnection* pointer,
+ without changing the reference count. It is the responsibility of
+ the caller to call dbus_connection_ref if it wants to store the
+ pointer.
+*/
+void *QDBusConnection::internalPointer() const
+{
+ return d ? d->connection : 0;
+}
+
+/*!
Returns true if this QDBusConnection object is connected.
*/
bool QDBusConnection::isConnected() const
@@ -932,6 +959,18 @@ QString QDBusConnection::name() const
}
/*!
+ \since 4.8
+
+ Returns the capabilities of this connection as negotiated with the bus
+ server or peer. If this QDBusConnection is not connected, this function
+ returns no capabilities.
+*/
+QDBusConnection::ConnectionCapabilities QDBusConnection::connectionCapabilities() const
+{
+ return d ? d->capabilities : ConnectionCapabilities(0);
+}
+
+/*!
Attempts to register the \a serviceName on the D-Bus server and
returns true if the registration succeeded. The registration will
fail if the name is already registered by another application.
@@ -972,7 +1011,16 @@ class QDBusDefaultConnection: public QDBusConnection
public:
inline QDBusDefaultConnection(BusType type, const char *name)
: QDBusConnection(connectToBus(type, QString::fromLatin1(name))), ownName(name)
- { }
+ {
+ // make sure this connection is running on the main thread
+ QCoreApplication *instance = QCoreApplication::instance();
+ if (!instance) {
+ qWarning("QDBusConnection: %s D-Bus connection created before QCoreApplication. Application may misbehave.",
+ type == SessionBus ? "session" : type == SystemBus ? "system" : "generic");
+ } else {
+ QDBusConnectionPrivate::d(*this)->moveToThread(instance->thread());
+ }
+ }
inline ~QDBusDefaultConnection()
{ disconnectFromBus(QString::fromLatin1(ownName)); }
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index ec59434..6ab0ea2 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -111,9 +111,13 @@ public:
UnregisterNode,
UnregisterTree
};
-
Q_DECLARE_FLAGS(RegisterOptions, RegisterOption)
+ enum ConnectionCapability {
+ UnixFileDescriptorPassing = 0x0001
+ };
+ Q_DECLARE_FLAGS(ConnectionCapabilities, ConnectionCapability)
+
QDBusConnection(const QString &name);
QDBusConnection(const QDBusConnection &other);
~QDBusConnection();
@@ -124,6 +128,7 @@ public:
QString baseService() const;
QDBusError lastError() const;
QString name() const;
+ ConnectionCapabilities connectionCapabilities() const;
bool send(const QDBusMessage &message) const;
bool callWithCallback(const QDBusMessage &message, QObject *receiver,
@@ -163,6 +168,8 @@ public:
QDBusConnectionInterface *interface() const;
+ void *internalPointer() const;
+
static QDBusConnection connectToBus(BusType type, const QString &name);
static QDBusConnection connectToBus(const QString &address, const QString &name);
static void disconnectFromBus(const QString &name);
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 85308c1..36f7c53 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -262,6 +262,7 @@ signals:
public:
QAtomicInt ref;
+ QDBusConnection::ConnectionCapabilities capabilities;
QString name; // this connection's name
QString baseService; // this connection's base service
diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp
index 6638263..111122e 100644
--- a/src/dbus/qdbusdemarshaller.cpp
+++ b/src/dbus/qdbusdemarshaller.cpp
@@ -128,7 +128,7 @@ inline QDBusSignature QDBusDemarshaller::toSignature()
inline QDBusVariant QDBusDemarshaller::toVariant()
{
- QDBusDemarshaller sub;
+ QDBusDemarshaller sub(capabilities);
sub.message = q_dbus_message_ref(message);
q_dbus_message_iter_recurse(&iterator, &sub.iterator);
q_dbus_message_iter_next(&iterator);
@@ -249,7 +249,7 @@ QStringList QDBusDemarshaller::toStringList()
{
QStringList list;
- QDBusDemarshaller sub;
+ QDBusDemarshaller sub(capabilities);
q_dbus_message_iter_recurse(&iterator, &sub.iterator);
q_dbus_message_iter_next(&iterator);
while (!sub.atEnd())
@@ -297,7 +297,7 @@ inline QDBusDemarshaller *QDBusDemarshaller::beginMapEntry()
QDBusDemarshaller *QDBusDemarshaller::beginCommon()
{
- QDBusDemarshaller *d = new QDBusDemarshaller;
+ QDBusDemarshaller *d = new QDBusDemarshaller(capabilities);
d->parent = this;
d->message = q_dbus_message_ref(message);
@@ -336,7 +336,7 @@ QDBusDemarshaller *QDBusDemarshaller::endCommon()
QDBusArgument QDBusDemarshaller::duplicate()
{
- QDBusDemarshaller *d = new QDBusDemarshaller;
+ QDBusDemarshaller *d = new QDBusDemarshaller(capabilities);
d->iterator = iterator;
d->message = q_dbus_message_ref(message);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 14138e0..ee917a5 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -535,7 +535,7 @@ qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data)
if (d->mode == QDBusConnectionPrivate::InvalidMode)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(message);
+ QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(message, d->capabilities);
qDBusDebug() << d << "got message (signal):" << amsg;
return d->handleMessage(amsg) ?
@@ -967,7 +967,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
extern bool qDBusInitThreads();
QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
- : QObject(p), ref(1), mode(InvalidMode), connection(0), server(0), busService(0),
+ : QObject(p), ref(1), capabilities(0), mode(InvalidMode), connection(0), server(0), busService(0),
watchAndTimeoutLock(QMutex::Recursive),
rootNode(QString(QLatin1Char('/')))
{
@@ -1204,7 +1204,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
QDBusMessagePrivate::setParametersValidated(message, true);
message.setArguments(args);
QDBusError error;
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error);
if (!msg) {
qWarning("QDBusConnection: Could not emit signal %s.%s: %s", qPrintable(interface), memberName.constData(),
qPrintable(error.message()));
@@ -1754,7 +1754,7 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
if (call->pending) {
// decode the message
DBusMessage *reply = q_dbus_pending_call_steal_reply(call->pending);
- msg = QDBusMessagePrivate::fromDBusMessage(reply);
+ msg = QDBusMessagePrivate::fromDBusMessage(reply, connection->capabilities);
q_dbus_message_unref(reply);
}
qDBusDebug() << connection << "got message reply (async):" << msg;
@@ -1805,7 +1805,7 @@ int QDBusConnectionPrivate::send(const QDBusMessage& message)
// through the d_ptr->localReply link
QDBusError error;
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error);
if (!msg) {
if (message.type() == QDBusMessage::MethodCallMessage)
qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s",
@@ -1851,7 +1851,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
if (!QCoreApplication::instance() || sendMode == QDBus::Block) {
QDBusError err;
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &err);
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &err);
if (!msg) {
qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s",
qPrintable(message.service()), qPrintable(message.path()),
@@ -1872,7 +1872,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
return QDBusMessage::createError(err);
}
- QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(reply);
+ QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(reply, capabilities);
q_dbus_message_unref(reply);
qDBusDebug() << this << "got message reply (blocking):" << amsg;
@@ -1948,7 +1948,7 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
pcall->ref = 0;
QDBusError error;
- DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
+ DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error);
if (!msg) {
qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s",
qPrintable(message.service()), qPrintable(message.path()),
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index 15e56e7..76d76cc 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -188,7 +188,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg)
return false;
}
- QDBusMarshaller sub;
+ QDBusMarshaller sub(capabilities);
open(sub, DBUS_TYPE_VARIANT, signature);
bool isOk = sub.appendVariantInternal(value);
// don't call sub.close(): it auto-closes
@@ -203,7 +203,7 @@ inline void QDBusMarshaller::append(const QStringList &arg)
return;
}
- QDBusMarshaller sub;
+ QDBusMarshaller sub(capabilities);
open(sub, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING);
QStringList::ConstIterator it = arg.constBegin();
QStringList::ConstIterator end = arg.constEnd();
@@ -280,6 +280,7 @@ void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature
sub.parent = this;
sub.ba = ba;
sub.ok = true;
+ sub.capabilities = capabilities;
if (ba)
switch (code) {
@@ -303,7 +304,7 @@ void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature
QDBusMarshaller *QDBusMarshaller::beginCommon(int code, const char *signature)
{
- QDBusMarshaller *d = new QDBusMarshaller;
+ QDBusMarshaller *d = new QDBusMarshaller(capabilities);
open(*d, code, signature);
return d;
}
@@ -362,7 +363,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
if (!d->message)
return false; // can't append this one...
- QDBusDemarshaller demarshaller;
+ QDBusDemarshaller demarshaller(capabilities);
demarshaller.message = q_dbus_message_ref(d->message);
if (d->direction == Demarshalling) {
@@ -528,7 +529,7 @@ bool QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller *demarshaller)
// We have to recurse
QDBusDemarshaller *drecursed = demarshaller->beginCommon();
- QDBusMarshaller mrecursed; // create on the stack makes it autoclose
+ QDBusMarshaller mrecursed(capabilities); // create on the stack makes it autoclose
QByteArray subSignature;
const char *sig = 0;
if (code == DBUS_TYPE_VARIANT || code == DBUS_TYPE_ARRAY) {
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index c13d483..bd77c77 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -95,14 +95,15 @@ QString QDBusMessage::errorMessage() const
/*!
\internal
- Constructs a DBusMessage object from this object. The returned value must be de-referenced
- with q_dbus_message_unref.
+ Constructs a DBusMessage object from \a message. The returned value must be de-referenced
+ with q_dbus_message_unref. The \a capabilities flags indicates which capabilities to use.
The \a error object is set to indicate the error if anything went wrong with the
marshalling. Usually, this error message will be placed in the reply, as if the call failed.
The \a error pointer must not be null.
*/
-DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDBusError *error)
+DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDBusConnection::ConnectionCapabilities capabilities,
+ QDBusError *error)
{
if (!qdbus_loadLibDBus()) {
*error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library"));
@@ -177,7 +178,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB
// we can record this fact
d_ptr->parametersValidated = true;
- QDBusMarshaller marshaller;
+ QDBusMarshaller marshaller(capabilities);
QVariantList::ConstIterator it = d_ptr->arguments.constBegin();
QVariantList::ConstIterator cend = d_ptr->arguments.constEnd();
q_dbus_message_iter_init_append(msg, &marshaller.iterator);
@@ -222,7 +223,7 @@ DBUS_DISABLE_CHECKS
\internal
Constructs a QDBusMessage by parsing the given DBusMessage object.
*/
-QDBusMessage QDBusMessagePrivate::fromDBusMessage(DBusMessage *dmsg)
+QDBusMessage QDBusMessagePrivate::fromDBusMessage(DBusMessage *dmsg, QDBusConnection::ConnectionCapabilities capabilities)
{
QDBusMessage message;
if (!dmsg)
@@ -238,7 +239,7 @@ QDBusMessage QDBusMessagePrivate::fromDBusMessage(DBusMessage *dmsg)
message.d_ptr->signature = QString::fromUtf8(q_dbus_message_get_signature(dmsg));
message.d_ptr->msg = q_dbus_message_ref(dmsg);
- QDBusDemarshaller demarshaller;
+ QDBusDemarshaller demarshaller(capabilities);
demarshaller.message = q_dbus_message_ref(dmsg);
if (q_dbus_message_iter_init(demarshaller.message, &demarshaller.iterator))
while (!demarshaller.atEnd())
@@ -272,7 +273,7 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn,
// we must marshall and demarshall again so as to create QDBusArgument
// entries for the complex types
QDBusError error;
- DBusMessage *message = toDBusMessage(asSent, &error);
+ DBusMessage *message = toDBusMessage(asSent, conn.capabilities, &error);
if (!message) {
// failed to marshall, so it's a call error
return QDBusMessage::createError(error);
@@ -280,7 +281,7 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn,
q_dbus_message_set_sender(message, conn.baseService.toUtf8());
- QDBusMessage retval = fromDBusMessage(message);
+ QDBusMessage retval = fromDBusMessage(message, conn.capabilities);
retval.d_ptr->localMessage = true;
q_dbus_message_unref(message);
if (retval.d_ptr->service.isEmpty())
diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h
index 6747976..52d4d25 100644
--- a/src/dbus/qdbusmessage_p.h
+++ b/src/dbus/qdbusmessage_p.h
@@ -56,6 +56,7 @@
#include <qatomic.h>
#include <qstring.h>
#include <qdbusmessage.h>
+#include <qdbusconnection.h>
struct DBusMessage;
@@ -92,8 +93,9 @@ public:
static void setParametersValidated(QDBusMessage &msg, bool enable)
{ msg.d_ptr->parametersValidated = enable; }
- static DBusMessage *toDBusMessage(const QDBusMessage &message, QDBusError *error);
- static QDBusMessage fromDBusMessage(DBusMessage *dmsg);
+ static DBusMessage *toDBusMessage(const QDBusMessage &message, QDBusConnection::ConnectionCapabilities capabilities,
+ QDBusError *error);
+ static QDBusMessage fromDBusMessage(DBusMessage *dmsg, QDBusConnection::ConnectionCapabilities capabilities);
static bool isLocal(const QDBusMessage &msg);
static QDBusMessage makeLocal(const QDBusConnectionPrivate &conn,