diff options
author | Kari Oikarinen <kari.oikarinen@qt.io> | 2019-01-08 08:20:10 +0200 |
---|---|---|
committer | Kari Oikarinen <kari.oikarinen@qt.io> | 2019-01-08 08:20:10 +0200 |
commit | 2ff39119f08fd23bc2cac404fdd3e0beb621e269 (patch) | |
tree | 3558529aec606befa9da7f4aa5781b5488ca9b0d | |
parent | b89cee7871b10ccb1e80cd0afa222e41f8ccdd6f (diff) | |
parent | ab6e0edd1a2e25a83c7884b7ce126e7039573eda (diff) |
Merge 5.12 into 5.12.1
Change-Id: I1bfbff1978013175b3b8aa737896902176ddaf7c
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | dist/changes-5.11.3 | 27 | ||||
-rw-r--r-- | examples/remoteobjects/ssl/sslcppclient/sslcppclient.pro | 3 | ||||
-rw-r--r-- | examples/remoteobjects/ssl/sslserver/sslserver.pro | 3 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_backend.cpp | 9 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_backend_p.h | 8 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_qiodevices.cpp | 42 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_qiodevices.h | 4 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_qiodevices_p.h | 1 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_server.cpp | 74 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_server.h | 2 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_server_p.h | 21 | ||||
-rw-r--r-- | src/remoteobjects/qremoteobjectreplica.cpp | 14 |
13 files changed, 129 insertions, 81 deletions
diff --git a/.qmake.conf b/.qmake.conf index 496efbe..3cfde09 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,6 +1,6 @@ load(qt_build_config) CONFIG += qt_example_installs -MODULE_VERSION = 5.12.0 +MODULE_VERSION = 5.12.1 QTRO_SOURCE_TREE = $$PWD diff --git a/dist/changes-5.11.3 b/dist/changes-5.11.3 new file mode 100644 index 0000000..28f337e --- /dev/null +++ b/dist/changes-5.11.3 @@ -0,0 +1,27 @@ +Qt 5.11.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.11.0 through 5.11.2. + +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.11.0 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.11.3 Changes * +**************************************************************************** + + - QRemoteObjectNode + * Fix a constant reconnect issue diff --git a/examples/remoteobjects/ssl/sslcppclient/sslcppclient.pro b/examples/remoteobjects/ssl/sslcppclient/sslcppclient.pro index f9a1541..07fb8da 100644 --- a/examples/remoteobjects/ssl/sslcppclient/sslcppclient.pro +++ b/examples/remoteobjects/ssl/sslcppclient/sslcppclient.pro @@ -1,3 +1,6 @@ +QT_FOR_CONFIG += network +requires(qtConfig(ssl)) + REPC_REPLICA += timemodel.rep QT = remoteobjects remoteobjects-private core diff --git a/examples/remoteobjects/ssl/sslserver/sslserver.pro b/examples/remoteobjects/ssl/sslserver/sslserver.pro index ac3802f..b8081d2 100644 --- a/examples/remoteobjects/ssl/sslserver/sslserver.pro +++ b/examples/remoteobjects/ssl/sslserver/sslserver.pro @@ -1,3 +1,6 @@ +QT_FOR_CONFIG += network +requires(qtConfig(ssl)) + CONFIG += console diff --git a/src/remoteobjects/qconnection_qnx_backend.cpp b/src/remoteobjects/qconnection_qnx_backend.cpp index 5a393aa..d9bd9c5 100644 --- a/src/remoteobjects/qconnection_qnx_backend.cpp +++ b/src/remoteobjects/qconnection_qnx_backend.cpp @@ -118,17 +118,16 @@ void QnxClientIo::onStateChanged(QAbstractSocket::SocketState state) initializeDataStream(); } -QnxServerIo::QnxServerIo(QIOQnxSource *conn, QObject *parent) +QnxServerIo::QnxServerIo(QSharedPointer<QIOQnxSource> conn, QObject *parent) : ServerIoDevice(parent), m_connection(conn) { - m_connection->setParent(this); - connect(conn, &QIODevice::readyRead, this, &ServerIoDevice::readyRead); - connect(conn, &QIOQnxSource::disconnected, this, &ServerIoDevice::disconnected); + connect(conn.data(), &QIODevice::readyRead, this, &ServerIoDevice::readyRead); + connect(conn.data(), &QIOQnxSource::disconnected, this, &ServerIoDevice::disconnected); } QIODevice *QnxServerIo::connection() const { - return m_connection; + return m_connection.data(); } void QnxServerIo::doClose() diff --git a/src/remoteobjects/qconnection_qnx_backend_p.h b/src/remoteobjects/qconnection_qnx_backend_p.h index b44b783..a2cfe80 100644 --- a/src/remoteobjects/qconnection_qnx_backend_p.h +++ b/src/remoteobjects/qconnection_qnx_backend_p.h @@ -99,7 +99,7 @@ class QnxClientIo final : public ClientIoDevice public: explicit QnxClientIo(QObject *parent = nullptr); - ~QnxClientIo(); + ~QnxClientIo() override; QIODevice *connection() const override; void connectToServer() override; @@ -119,7 +119,7 @@ private: class QnxServerIo final : public ServerIoDevice { public: - explicit QnxServerIo(QIOQnxSource *conn, QObject *parent = nullptr); + explicit QnxServerIo(QSharedPointer<QIOQnxSource> conn, QObject *parent = nullptr); QIODevice *connection() const override; protected: @@ -127,7 +127,7 @@ protected: private: //TODO Source or Replica - QIOQnxSource *m_connection; + QSharedPointer<QIOQnxSource> m_connection; }; class QnxServerImpl final : public QConnectionAbstractServer @@ -136,7 +136,7 @@ class QnxServerImpl final : public QConnectionAbstractServer public: explicit QnxServerImpl(QObject *parent); - ~QnxServerImpl(); + ~QnxServerImpl() override; bool hasPendingConnections() const override; ServerIoDevice *configureNewConnection() override; diff --git a/src/remoteobjects/qconnection_qnx_qiodevices.cpp b/src/remoteobjects/qconnection_qnx_qiodevices.cpp index b12cb7d..61bf857 100644 --- a/src/remoteobjects/qconnection_qnx_qiodevices.cpp +++ b/src/remoteobjects/qconnection_qnx_qiodevices.cpp @@ -115,7 +115,7 @@ bool QQnxNativeIoPrivate::establishConnection() //mismatch between code compiled with vs. without HAM //(which could happen if we ever use QCONN between //devices) - if (MsgSendv(serverId, tx_iov, 3, NULL, 0) == -1) { + if (MsgSendv(serverId, tx_iov, 3, nullptr, 0) == -1) { WARNING(MsgSendv) teardownConnection(); return false; @@ -171,7 +171,7 @@ void QQnxNativeIoPrivate::thread_func() bool running = true; int nTxRequestToIgnore = 0; while (running) { - int rcvid = MsgReceivePulse(channelId, &pulse, sizeof(pulse), NULL); + int rcvid = MsgReceivePulse(channelId, &pulse, sizeof(pulse), nullptr); if (rcvid == -1) continue; @@ -180,7 +180,7 @@ void QQnxNativeIoPrivate::thread_func() switch (pulse.code) { case SOURCE_TX_RQ: //The Source object wants to send us data { - quint32 len = pulse.value.sival_int; + const int len = pulse.value.sival_int; qCDebug(QT_REMOTEOBJECT, "TX request with len = %d, tx ignore = %d", len, nTxRequestToIgnore); if (nTxRequestToIgnore) { --nTxRequestToIgnore; @@ -235,7 +235,7 @@ void QQnxNativeIoPrivate::thread_func() msgType = MsgType::REPLICA_TX_RECV; SETIOV(tx_iov + 1, payload.constData(), len); - if (MsgSendvs(serverId, tx_iov, 2, NULL, 0) == -1) { + if (MsgSendvs(serverId, tx_iov, 2, nullptr, 0) == -1) { WARNING(MsgSendvs); obLock.lockForWrite(); if (obuffer->isEmpty()) { @@ -390,10 +390,9 @@ bool QQnxNativeIo::isSequential() const qint64 QQnxNativeIo::bytesAvailable() const { Q_D(const QQnxNativeIo); - quint64 size; d->ibLock.lockForRead(); - size = d->buffer.size(); + qint64 size = d->buffer.size(); d->ibLock.unlock(); return size; @@ -402,10 +401,9 @@ qint64 QQnxNativeIo::bytesAvailable() const qint64 QQnxNativeIo::bytesToWrite() const { Q_D(const QQnxNativeIo); - quint64 size; d->obLock.lockForRead(); - size = d->obuffer->size(); + qint64 size = d->obuffer->size(); d->obLock.unlock(); return size; @@ -482,11 +480,18 @@ qint64 QQnxNativeIo::writeData(const char *data, qint64 size) if (!isWritable()) return 0; + if (size < 0 || size > INT_MAX) { + qCWarning(QT_REMOTEOBJECT) << "Invalid size (" << size << ") passed to QtRO QNX backend writeData()."; + return -1; + } + + int isize = static_cast<int>(size); + d->obLock.lockForWrite(); - d->obuffer->append(QByteArray(data, size)); + d->obuffer->append(QByteArray(data, isize)); d->obLock.unlock(); - WARN_AND_RETURN_ON_ERROR(MsgSendPulse, -1, d->connectionId, -1, PulseType::REPLICA_WRITE, size) + WARN_AND_RETURN_ON_ERROR(MsgSendPulse, -1, d->connectionId, -1, PulseType::REPLICA_WRITE, isize) return size; } @@ -519,10 +524,9 @@ bool QIOQnxSource::isSequential() const qint64 QIOQnxSource::bytesAvailable() const { Q_D(const QIOQnxSource); - quint64 size; d->ibLock.lockForRead(); - size = d->buffer.size(); + qint64 size = d->buffer.size(); d->ibLock.unlock(); return size; @@ -531,10 +535,9 @@ qint64 QIOQnxSource::bytesAvailable() const qint64 QIOQnxSource::bytesToWrite() const { Q_D(const QIOQnxSource); - quint64 size; d->obLock.lockForRead(); - size = d->obuffer.size(); + qint64 size = d->obuffer.size(); d->obLock.unlock(); return size; @@ -618,12 +621,19 @@ qint64 QIOQnxSource::writeData(const char *data, qint64 size) if (!isWritable()) return 0; + if (size < 0 || size > INT_MAX) { + qCWarning(QT_REMOTEOBJECT) << "Invalid size (" << size << ") passed to QtRO QNX backend writeData()."; + return -1; + } + + int isize = static_cast<int>(size); + d->obLock.lockForWrite(); - d->obuffer.append(QByteArray(data, size)); + d->obuffer.append(QByteArray(data, isize)); d->obLock.unlock(); if (!d->m_serverClosing.load()) { - d->m_event.sigev_value.sival_int = size; + d->m_event.sigev_value.sival_int = isize; WARN_ON_ERROR(MsgDeliverEvent, d->rcvid, &(d->m_event)) } diff --git a/src/remoteobjects/qconnection_qnx_qiodevices.h b/src/remoteobjects/qconnection_qnx_qiodevices.h index 541b455..7a59a72 100644 --- a/src/remoteobjects/qconnection_qnx_qiodevices.h +++ b/src/remoteobjects/qconnection_qnx_qiodevices.h @@ -71,7 +71,7 @@ class Q_REMOTEOBJECTS_EXPORT QQnxNativeIo : public QIODevice public: explicit QQnxNativeIo(QObject *parent = nullptr); - ~QQnxNativeIo(); + ~QQnxNativeIo() override; bool connectToServer(OpenMode openMode = ReadWrite); bool connectToServer(const QString &name, OpenMode openMode = ReadWrite); @@ -118,7 +118,7 @@ class Q_REMOTEOBJECTS_EXPORT QIOQnxSource : public QIODevice public: explicit QIOQnxSource(int rcvid, QObject *parent = nullptr); - ~QIOQnxSource(); + ~QIOQnxSource() override; bool isSequential() const override; qint64 bytesAvailable() const override; diff --git a/src/remoteobjects/qconnection_qnx_qiodevices_p.h b/src/remoteobjects/qconnection_qnx_qiodevices_p.h index 854a5b4..5c3d28a 100644 --- a/src/remoteobjects/qconnection_qnx_qiodevices_p.h +++ b/src/remoteobjects/qconnection_qnx_qiodevices_p.h @@ -52,6 +52,7 @@ // #include "qconnection_qnx_qiodevices.h" +#include "qconnection_qnx_global_p.h" #include <QReadWriteLock> #include <QScopedPointer> diff --git a/src/remoteobjects/qconnection_qnx_server.cpp b/src/remoteobjects/qconnection_qnx_server.cpp index 34e1959..361a554 100644 --- a/src/remoteobjects/qconnection_qnx_server.cpp +++ b/src/remoteobjects/qconnection_qnx_server.cpp @@ -38,9 +38,7 @@ ****************************************************************************/ #include "qconnection_qnx_global_p.h" -#include "qconnection_qnx_qiodevices.h" #include "qconnection_qnx_qiodevices_p.h" -#include "qconnection_qnx_server.h" #include "qconnection_qnx_server_p.h" QT_BEGIN_NAMESPACE @@ -99,14 +97,13 @@ bool QQnxNativeServer::listen(const QString &name) return true; } -QIOQnxSource *QQnxNativeServer::nextPendingConnection() +QSharedPointer<QIOQnxSource> QQnxNativeServer::nextPendingConnection() { Q_D(QQnxNativeServer); d->mutex.lock(); Q_ASSERT(d->pending.length() > 0); - QIOQnxSource *io = d->pending.takeFirst(); + auto io = d->pending.takeFirst(); d->mutex.unlock(); - io->setParent(this); return io; } @@ -136,6 +133,18 @@ void QQnxNativeServer::onSourceClosed() d->cleanupIOSource(conn); } +QQnxNativeServerPrivate::QQnxNativeServerPrivate() + : error(QAbstractSocket::UnknownSocketError) + , thread(this, QStringLiteral("NativeServer")) +{ +} + +QQnxNativeServerPrivate::~QQnxNativeServerPrivate() +{ + if (thread.isRunning()) + teardownServer(); +} + // method (run in a thread) to watch for connections and handle receiving data void QQnxNativeServerPrivate::thread_func() { @@ -170,7 +179,7 @@ void QQnxNativeServerPrivate::thread_func() Q_FOREACH (int coid, coids) { const uint64_t uid = static_cast<uint64_t>(scoid) << 32 | static_cast<uint32_t>(coid); - QIOQnxSource *io = NULL; + QSharedPointer<QIOQnxSource> io; mutex.lock(); if (sources.contains(uid)) io = sources.take(uid); @@ -181,10 +190,9 @@ void QQnxNativeServerPrivate::thread_func() ham_action_handle_free(action); #endif - if (io) { + if (!io.isNull()) { io->d_func()->m_serverClosing.ref(); - QMetaObject::invokeMethod(io,"onDisconnected",Qt::QueuedConnection); - io->deleteLater(); + QMetaObject::invokeMethod(io.data(),"onDisconnected",Qt::QueuedConnection); } } @@ -201,11 +209,11 @@ void QQnxNativeServerPrivate::thread_func() */ const int coid = recv_buf.pulse.value.sival_int; - if (ConnectServerInfo(0, coid, NULL) != coid) { + if (ConnectServerInfo(0, coid, nullptr) != coid) { const int scoid = recv_buf.pulse.scoid; if (connections.value(scoid).contains(coid)) connections[scoid].remove(coid); - QIOQnxSource *io = NULL; + QSharedPointer<QIOQnxSource> io; const uint64_t uid = static_cast<uint64_t>(scoid) << 32 | static_cast<uint32_t>(coid); mutex.lock(); if (sources.contains(uid)) @@ -217,10 +225,9 @@ void QQnxNativeServerPrivate::thread_func() ham_action_handle_free(action); #endif - if (io) { + if (!io.isNull()) { io->d_func()->m_serverClosing.ref(); - QMetaObject::invokeMethod(io,"onDisconnected",Qt::QueuedConnection); - io->deleteLater(); + QMetaObject::invokeMethod(io.data(),"onDisconnected",Qt::QueuedConnection); } qCDebug(QT_REMOTEOBJECT) << "Connection dropped" << coid; } @@ -286,7 +293,7 @@ void QQnxNativeServerPrivate::thread_func() const uint64_t uid = static_cast<uint64_t>(msg_info.scoid) << 32 | static_cast<uint32_t>(msg_info.coid); mutex.lock(); Q_ASSERT(sources.contains(uid)); - QIOQnxSource *io = sources.value(uid); + auto io = sources.value(uid); mutex.unlock(); io->d_func()->obLock.lockForWrite(); //NAR (Not-An-Error) @@ -310,7 +317,7 @@ void QQnxNativeServerPrivate::thread_func() const uint64_t uid = static_cast<uint64_t>(msg_info.scoid) << 32 | static_cast<uint32_t>(msg_info.coid); mutex.lock(); Q_ASSERT(sources.contains(uid)); - QIOQnxSource *io = sources.value(uid); + auto io = sources.value(uid); mutex.unlock(); int len_taken = 0; @@ -347,7 +354,7 @@ void QQnxNativeServerPrivate::thread_func() const uint64_t uid = static_cast<uint64_t>(msg_info.scoid) << 32 | static_cast<uint32_t>(msg_info.coid); mutex.lock(); Q_ASSERT(sources.contains(uid)); - QIOQnxSource *io = sources.value(uid); + auto io = sources.value(uid); mutex.unlock(); //Long-lock, use buffer+memcpy if we run into trouble @@ -367,7 +374,7 @@ void QQnxNativeServerPrivate::thread_func() io->d_func()->buffer.chop(toRead - res); io->d_func()->ibLock.unlock(); - FATAL_ON_ERROR(MsgReply, rcvid, EOK, NULL, 0) + FATAL_ON_ERROR(MsgReply, rcvid, EOK, nullptr, 0) qCDebug(QT_REMOTEOBJECT) << "server received REPLICA_TX_RECV" << payload << toRead; @@ -382,7 +389,7 @@ void QQnxNativeServerPrivate::thread_func() } } mutex.lock(); - Q_FOREACH (QIOQnxSource *io, sources) + for (auto io: sources) io->d_func()->m_serverClosing.ref(); mutex.unlock(); name_detach(attachStruct, 0); @@ -392,7 +399,7 @@ void QQnxNativeServerPrivate::thread_func() bool QQnxNativeServerPrivate::listen(const QString &name) { - attachStruct = name_attach(NULL, qPrintable(name), 0); + attachStruct = name_attach(nullptr, qPrintable(name), 0); if (attachStruct == nullptr) { qCDebug(QT_REMOTEOBJECT, "name_attach call failed"); return false; @@ -406,17 +413,20 @@ bool QQnxNativeServerPrivate::listen(const QString &name) void QQnxNativeServerPrivate::cleanupIOSource(QIOQnxSource *conn) { - QIOQnxSource *io = NULL; + QSharedPointer<QIOQnxSource> io; mutex.lock(); - const uint64_t uid = sources.key(conn, UINT64_MAX); - - if (uid != UINT64_MAX) { - io = sources.take(uid); - io->d_func()->m_serverClosing.ref(); + QHashIterator<uint64_t, QSharedPointer<QIOQnxSource>> i(sources); + while (i.hasNext()) { + i.next(); + if (i.value().data() == conn) + io = sources.take(i.key()); + break; } mutex.unlock(); - if (io) + if (!io.isNull()) { + io->d_func()->m_serverClosing.ref(); io->close(); + } } void QQnxNativeServerPrivate::teardownServer() @@ -440,17 +450,19 @@ void QQnxNativeServerPrivate::teardownServer() void QQnxNativeServerPrivate::createSource(int rcvid, uint64_t uid, pid_t toPid) { Q_Q(QQnxNativeServer); - QIOQnxSource *io = new QIOQnxSource(rcvid); +#ifndef USE_HAM + Q_UNUSED(toPid); +#endif + auto io = QSharedPointer<QIOQnxSource>(new QIOQnxSource(rcvid)); io->moveToThread(q->thread()); - io->setParent(q); - QObject::connect(io, &QIOQnxSource::aboutToClose, + QObject::connect(io.data(), &QIOQnxSource::aboutToClose, q, &QQnxNativeServer::onSourceClosed); QIOQnxSourcePrivate *iop = io->d_func(); FATAL_ON_ERROR(MsgRead, rcvid, &(iop->m_event), sizeof(sigevent), sizeof(MsgType)) int sentChannelId; FATAL_ON_ERROR(MsgRead, rcvid, &sentChannelId, sizeof(int), sizeof(MsgType)+sizeof(sigevent)) - FATAL_ON_ERROR(MsgReply, rcvid, EOK, NULL, 0) + FATAL_ON_ERROR(MsgReply, rcvid, EOK, nullptr, 0) mutex.lock(); sources.insert(uid, io); diff --git a/src/remoteobjects/qconnection_qnx_server.h b/src/remoteobjects/qconnection_qnx_server.h index cf39d17..3b168b1 100644 --- a/src/remoteobjects/qconnection_qnx_server.h +++ b/src/remoteobjects/qconnection_qnx_server.h @@ -65,7 +65,7 @@ public: bool hasPendingConnections() const; bool isListening() const; bool listen(const QString &name); - QIOQnxSource *nextPendingConnection(); + QSharedPointer<QIOQnxSource> nextPendingConnection(); QString serverName() const; bool waitForNewConnection(int msec = 0, bool *timedOut = nullptr); diff --git a/src/remoteobjects/qconnection_qnx_server_p.h b/src/remoteobjects/qconnection_qnx_server_p.h index 8f0be3b..5913d3d 100644 --- a/src/remoteobjects/qconnection_qnx_server_p.h +++ b/src/remoteobjects/qconnection_qnx_server_p.h @@ -51,11 +51,13 @@ // We mean it. // -#include "qconnection_qnx_server.h" #include "private/qobject_p.h" +#include "qconnection_qnx_server.h" +#include "qconnection_qnx_global_p.h" #include <QAtomicInt> #include <QMutex> +#include <QSharedPointer> QT_BEGIN_NAMESPACE @@ -64,18 +66,9 @@ class QQnxNativeServerPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQnxNativeServer) public: - QQnxNativeServerPrivate() - : - error(QAbstractSocket::UnknownSocketError) - , thread(this, QStringLiteral("NativeServer")) - { - } + QQnxNativeServerPrivate(); - ~QQnxNativeServerPrivate() - { - if (thread.isRunning()) - teardownServer(); - } + ~QQnxNativeServerPrivate(); void thread_func(); @@ -94,8 +87,8 @@ public: QString serverName; name_attach_t *attachStruct; QHash<int, QSet<int> > connections; - QHash<uint64_t, QIOQnxSource *> sources; - QList<QIOQnxSource *> pending; + QHash<uint64_t, QSharedPointer<QIOQnxSource>> sources; + QList<QSharedPointer<QIOQnxSource>> pending; QAtomicInt running; Thread<QQnxNativeServerPrivate> thread; mutable QMutex mutex; diff --git a/src/remoteobjects/qremoteobjectreplica.cpp b/src/remoteobjects/qremoteobjectreplica.cpp index e9c2dbb..586288d 100644 --- a/src/remoteobjects/qremoteobjectreplica.cpp +++ b/src/remoteobjects/qremoteobjectreplica.cpp @@ -173,7 +173,7 @@ void QRemoteObjectReplicaImplementation::setState(QRemoteObjectReplica::State st const static int stateChangedIndex = QRemoteObjectReplica::staticMetaObject.indexOfMethod("stateChanged(State,State)"); Q_ASSERT(stateChangedIndex != -1); - void *args[] = {0, &state, &oldState}; + void *args[] = {nullptr, &state, &oldState}; QMetaObject::activate(this, metaObject(), stateChangedIndex, args); } @@ -237,7 +237,7 @@ void QRemoteObjectReplicaImplementation::emitInitialized() { const static int initializedIndex = QRemoteObjectReplica::staticMetaObject.indexOfMethod("initialized()"); Q_ASSERT(initializedIndex != -1); - void *noArgs[] = {0}; + void *noArgs[] = {nullptr}; QMetaObject::activate(this, metaObject(), initializedIndex, noArgs); } @@ -334,7 +334,7 @@ bool QConnectedReplicaImplementation::waitForSource(int timeout) QEventLoop loop; QMetaObject::connect(this, stateChangedIndex, &loop, QEventLoop::staticMetaObject.indexOfMethod("quit()"), - Qt::DirectConnection, 0); + Qt::DirectConnection, nullptr); if (timeout >= 0) { QTimer::singleShot(timeout, &loop, SLOT(quit())); @@ -496,7 +496,7 @@ void QRemoteObjectReplicaImplementation::configurePrivate(QRemoteObjectReplica * { const QMetaMethod mm = m->method(i); if (mm.methodType() == QMetaMethod::Signal) { - const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, 0); + const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, nullptr); qCDebug(QT_REMOTEOBJECT) << " Rep connect"<<i<<res<<mm.name(); Q_UNUSED(res); } @@ -519,7 +519,7 @@ void QRemoteObjectReplicaImplementation::configurePrivate(QRemoteObjectReplica * const QMetaMethod mm = metaObject->method(i); if (mm.methodType() == QMetaMethod::Signal) { ++m_numSignals; - const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, 0); + const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, nullptr); qCDebug(QT_REMOTEOBJECT) << " Connect"<<i<<res<<mm.name(); Q_UNUSED(res); } @@ -528,7 +528,7 @@ void QRemoteObjectReplicaImplementation::configurePrivate(QRemoteObjectReplica * qCDebug(QT_REMOTEOBJECT) << QStringLiteral("configurePrivate finished, signalOffset = %1, methodOffset = %2, #Signals = %3").arg(m_signalOffset).arg(m_methodOffset).arg(m_numSignals); } else { //We have initialized offsets, this is an additional Replica attaching for (int i = m_signalOffset; i < m_methodOffset; ++i) { - const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, 0); + const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, nullptr); qCDebug(QT_REMOTEOBJECT) << " Connect"<<i<<res<<m_metaObject->method(i).name(); Q_UNUSED(res); } @@ -625,7 +625,7 @@ void QConnectedReplicaImplementation::configurePrivate(QRemoteObjectReplica *rep */ QRemoteObjectReplica::QRemoteObjectReplica(ConstructorType t) : QObject(nullptr) - , d_impl(t == DefaultConstructor ? new QStubReplicaImplementation : 0) + , d_impl(t == DefaultConstructor ? new QStubReplicaImplementation : nullptr) { qRegisterMetaType<State>("State"); } |