diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-01 11:50:31 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-01 11:50:31 +0100 |
commit | 3df5d656896904d5db5983a7218643f1a43acdbb (patch) | |
tree | 3f98942663abaec3a389f5ab15ce67f2c8c9999b | |
parent | d3cde521533787f5f91364ffdba3e0a386d131f6 (diff) | |
parent | e1c0dbeadcfd34699f080edc49815761672616c1 (diff) |
Merge remote-tracking branch 'origin/5.12.1' into 5.12
Change-Id: I3822ef45344b07191c3b32883241db5e43e04187
-rw-r--r-- | dist/changes-5.12.1 | 30 | ||||
-rw-r--r-- | src/remoteobjects/qremoteobjectreplica.cpp | 6 | ||||
-rw-r--r-- | src/remoteobjects/qremoteobjectsource.cpp | 53 | ||||
-rw-r--r-- | src/remoteobjects/qremoteobjectsource_p.h | 2 | ||||
-rw-r--r-- | src/remoteobjects/qremoteobjectsourceio.cpp | 4 |
5 files changed, 74 insertions, 21 deletions
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 diff --git a/src/remoteobjects/qremoteobjectreplica.cpp b/src/remoteobjects/qremoteobjectreplica.cpp index 031b6b7..c663efd 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 cae5f31..d855220 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<void*, 10> 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<void*>(reinterpret_cast<const void*>(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<void*>(reinterpret_cast<const void*>(&args.at(i))); + } + return const_cast<void*>(args.at(i).data()); + }; + for (int i = 0; i < args.size(); ++i) { - param[i + 1] = const_cast<void*>(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<void*>(args.at(i).data()); + if (isQVariant) + param[i] = const_cast<void*>(reinterpret_cast<const void*>(&args.at(i))); + else + param[i] = const_cast<void*>(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<void*>(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 e5087f7..a94885d 100644 --- a/src/remoteobjects/qremoteobjectsource_p.h +++ b/src/remoteobjects/qremoteobjectsource_p.h @@ -80,7 +80,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<int, QPointer<QRemoteObjectSourceBase>> m_children; struct Private { diff --git a/src/remoteobjects/qremoteobjectsourceio.cpp b/src/remoteobjects/qremoteobjectsourceio.cpp index 0b9cfc1..c2dc70a 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; |