From b89cee7871b10ccb1e80cd0afa222e41f8ccdd6f Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 18 Dec 2018 10:19:59 +0200 Subject: QVariant is also a standalone type and we must treated accordingly QVariant::data() gives us access to its internal pointer of the internal data type, but if the type is a QVariant we can't use QVariant::data() anymore. Change-Id: Ifad5f5d5884913c38b289c69b50630c735eea7d6 Fix: QTBUG-72064 Reviewed-by: Brett Stottlemyer --- src/remoteobjects/qremoteobjectreplica.cpp | 6 ++-- src/remoteobjects/qremoteobjectsource.cpp | 53 +++++++++++++++++++++-------- src/remoteobjects/qremoteobjectsource_p.h | 2 +- src/remoteobjects/qremoteobjectsourceio.cpp | 4 +-- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/src/remoteobjects/qremoteobjectreplica.cpp b/src/remoteobjects/qremoteobjectreplica.cpp index 092bed7..e9c2dbb 100644 --- a/src/remoteobjects/qremoteobjectreplica.cpp +++ b/src/remoteobjects/qremoteobjectreplica.cpp @@ -800,13 +800,13 @@ void QInProcessReplicaImplementation::_q_send(QMetaObject::Call call, int index, if (resolvedIndex < 0) qCWarning(QT_REMOTEOBJECT) << "Skipping invalid invocation. Index not found:" << index - m_methodOffset; else - connectionToSource->invoke(call, api->isAdapterMethod(index - m_methodOffset), resolvedIndex, args); + connectionToSource->invoke(call, index - m_methodOffset, args); } else { const int resolvedIndex = connectionToSource->m_api->sourcePropertyIndex(index - m_propertyOffset); if (resolvedIndex < 0) qCWarning(QT_REMOTEOBJECT) << "Skipping invalid property setter. Index not found:" << index - m_propertyOffset; else - connectionToSource->invoke(call, api->isAdapterProperty(index - m_propertyOffset), resolvedIndex, args); + connectionToSource->invoke(call, index - m_propertyOffset, args); } } @@ -826,7 +826,7 @@ QRemoteObjectPendingCall QInProcessReplicaImplementation::_q_sendWithReply(QMeta return QRemoteObjectPendingCall(); } - connectionToSource->invoke(call, connectionToSource->m_api->isAdapterMethod(ReplicaIndex), resolvedIndex, args, &returnValue); + connectionToSource->invoke(call, ReplicaIndex, args, &returnValue); return QRemoteObjectPendingCall::fromCompletedCall(returnValue); } diff --git a/src/remoteobjects/qremoteobjectsource.cpp b/src/remoteobjects/qremoteobjectsource.cpp index 5cbc195..47c01bc 100644 --- a/src/remoteobjects/qremoteobjectsource.cpp +++ b/src/remoteobjects/qremoteobjectsource.cpp @@ -273,41 +273,64 @@ QVariantList* QRemoteObjectSourceBase::marshalArgs(int index, void **a) return &m_marshalledArgs; } -bool QRemoteObjectSourceBase::invoke(QMetaObject::Call c, bool forAdapter, int index, const QVariantList &args, QVariant* returnValue) +bool QRemoteObjectSourceBase::invoke(QMetaObject::Call c, int index, const QVariantList &args, QVariant* returnValue) { int status = -1; int flags = 0; - + bool forAdapter = (c == QMetaObject::InvokeMetaMethod ? m_api->isAdapterMethod(index) : m_api->isAdapterProperty(index)); + int resolvedIndex = (c == QMetaObject::InvokeMetaMethod ? m_api->sourceMethodIndex(index) : m_api->sourcePropertyIndex(index)); + if (resolvedIndex < 0) + return false; QVarLengthArray param(args.size() + 1); if (c == QMetaObject::InvokeMetaMethod) { + QMetaMethod method; + if (!forAdapter) + method = parent()->metaObject()->method(resolvedIndex); + if (returnValue) { - param[0] = returnValue->data(); + if (!forAdapter && method.isValid() && method.returnType() == QMetaType::QVariant) + param[0] = const_cast(reinterpret_cast(returnValue)); + else + param[0] = returnValue->data(); } else { param[0] = nullptr; } + auto argument = [&](int i) -> void * { + if ((forAdapter && m_api->methodParameterType(index, i) == QMetaType::QVariant) || + (method.isValid() && method.parameterType(i) == QMetaType::QVariant)) { + return const_cast(reinterpret_cast(&args.at(i))); + } + return const_cast(args.at(i).data()); + }; + for (int i = 0; i < args.size(); ++i) { - param[i + 1] = const_cast(args.at(i).data()); + param[i + 1] = argument(i); } - } else if (c == QMetaObject::WriteProperty) { + } else if (c == QMetaObject::WriteProperty || c == QMetaObject::ReadProperty) { + bool isQVariant = !forAdapter && parent()->metaObject()->property(resolvedIndex).userType() == QMetaType::QVariant; for (int i = 0; i < args.size(); ++i) { - param[i] = const_cast(args.at(i).data()); + if (isQVariant) + param[i] = const_cast(reinterpret_cast(&args.at(i))); + else + param[i] = const_cast(args.at(i).data()); } - Q_ASSERT(param.size() == 2); // for return-value and setter value - // check QMetaProperty::write for an explanation of these - param.append(&status); - param.append(&flags); - } else { - for (int i = 0; i < args.size(); ++i) { - param[i] = const_cast(args.at(i).data()); + if (c == QMetaObject::WriteProperty) { + Q_ASSERT(param.size() == 2); // for return-value and setter value + // check QMetaProperty::write for an explanation of these + param.append(&status); + param.append(&flags); } + } else { + // Better safe than sorry + return false; } int r = -1; if (forAdapter) - r = m_adapter->qt_metacall(c, index, param.data()); + r = m_adapter->qt_metacall(c, resolvedIndex, param.data()); else - r = parent()->qt_metacall(c, index, param.data()); + r = parent()->qt_metacall(c, resolvedIndex, param.data()); return r == -1 && status == -1; } diff --git a/src/remoteobjects/qremoteobjectsource_p.h b/src/remoteobjects/qremoteobjectsource_p.h index 2961e5c..63f623c 100644 --- a/src/remoteobjects/qremoteobjectsource_p.h +++ b/src/remoteobjects/qremoteobjectsource_p.h @@ -81,7 +81,7 @@ public: QVariantList* marshalArgs(int index, void **a); void handleMetaCall(int index, QMetaObject::Call call, void **a); - bool invoke(QMetaObject::Call c, bool forAdapter, int index, const QVariantList& args, QVariant* returnValue = nullptr); + bool invoke(QMetaObject::Call c, int index, const QVariantList& args, QVariant* returnValue = nullptr); QByteArray m_objectChecksum; QMap> m_children; struct Private { diff --git a/src/remoteobjects/qremoteobjectsourceio.cpp b/src/remoteobjects/qremoteobjectsourceio.cpp index c5bf36e..25d69dc 100644 --- a/src/remoteobjects/qremoteobjectsourceio.cpp +++ b/src/remoteobjects/qremoteobjectsourceio.cpp @@ -240,7 +240,7 @@ void QRemoteObjectSourceIo::onServerRead(QObject *conn) if (!QMetaType(typeId).sizeOf()) typeId = QVariant::Invalid; QVariant returnValue(typeId, nullptr); - source->invoke(QMetaObject::InvokeMetaMethod, source->m_api->isAdapterMethod(index), resolvedIndex, m_rxArgs, &returnValue); + source->invoke(QMetaObject::InvokeMetaMethod, index, m_rxArgs, &returnValue); // send reply if wanted if (serialId >= 0) { serializeInvokeReplyPacket(m_packet, m_rxName, serialId, returnValue); @@ -257,7 +257,7 @@ void QRemoteObjectSourceIo::onServerRead(QObject *conn) qRODebug(this) << "Adapter (write property) Invoke-->" << m_rxName << source->m_adapter->metaObject()->property(resolvedIndex).name(); else qRODebug(this) << "Source (write property) Invoke-->" << m_rxName << source->m_object->metaObject()->property(resolvedIndex).name(); - source->invoke(QMetaObject::WriteProperty, source->m_api->isAdapterProperty(index), resolvedIndex, m_rxArgs); + source->invoke(QMetaObject::WriteProperty, index, m_rxArgs); } } break; -- cgit v1.2.3 From e1c0dbeadcfd34699f080edc49815761672616c1 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Wed, 9 Jan 2019 10:09:42 +0200 Subject: Add changes file for Qt 5.12.1 + 9fcf2a90db6d6dce1fe03a2f7af4c4a148c35087 Bump version + 92ae729691f6db9fb06b0475509dc1141ac3d93c Add changes file for Qt 5.11.3 + 62ee032065ac40062d4d1d0ed448062e611012ad Clean up windows qmake scopes + d369df14bc634dde9c4c1a101379bb5a536f0332 Doc: Add missing closing parenthesis in snippet + 7844b91364665fa4c0592bd6fbe3ec8433dcbe9e Fix compilation with gcc 4.8 + 0eb8ff632f0580f18a7b8de97dc0a2175f61943f Only include the ssl example and test if the OpenSSL feature is available + 8eeb21548a6675f73fb5b3c54b73373d87cdae32 SSL Examples: Explicitly state SSL requirement + 76819c0316c03d1333d8e8c93bc7a3d8df4891ea Convert QNX backend to use shared pointers + b513d17fe19c3cf8790d989626521b52f6d1b3d6 Clang warning cleanup in qnx backend + b89cee7871b10ccb1e80cd0afa222e41f8ccdd6f QVariant is also a standalone type and we must treated accordingly + ab6e0edd1a2e25a83c7884b7ce126e7039573eda Bump version Change-Id: I5ce74358fa5e1324f1ecdc3a0e28ae411b19db8f Reviewed-by: Michael Brasser --- dist/changes-5.12.1 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 dist/changes-5.12.1 diff --git a/dist/changes-5.12.1 b/dist/changes-5.12.1 new file mode 100644 index 0000000..dfb633f --- /dev/null +++ b/dist/changes-5.12.1 @@ -0,0 +1,30 @@ +Qt 5.12.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +Note: Tech Preview modules are able to change APIs to refine or enhance the +module's functionality. Thus Qt's binary compatibility quarantees aren't +applicable. Code switching to 5.12 (when Remote Objects "graduated" from +Tech Preview) from earlier versions of Qt Remote Objects will need to be +recompiled. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.12.1 Changes * +**************************************************************************** + - General + * [QTBUG-72064] QVariant is also a standalone type and we must treat it + accordingly + * Convert QNX backend to use shared pointers + * Various code cleanup -- cgit v1.2.3 From 08f12f69b19ba3a893feeb71d289e807fe051b8e Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 5 Feb 2019 21:00:30 +0100 Subject: examples: require widgets explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3f34288d29c3290f61817575053f4fdb0a536b9e Reviewed-by: Tony Sarajärvi Reviewed-by: Brett Stottlemyer --- examples/remoteobjects/remoteobjects.pro | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/remoteobjects/remoteobjects.pro b/examples/remoteobjects/remoteobjects.pro index e1e0d63..e4dd62a 100644 --- a/examples/remoteobjects/remoteobjects.pro +++ b/examples/remoteobjects/remoteobjects.pro @@ -3,10 +3,14 @@ CONFIG += debug_and_release ordered SUBDIRS = \ server \ cppclient \ - modelviewclient \ - modelviewserver \ simpleswitch +qtHaveModule(widgets) { + SUBDIRS += \ + modelviewclient \ + modelviewserver +} + contains(QT_CONFIG, ssl): SUBDIRS += ssl qtHaveModule(quick) { -- cgit v1.2.3