aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-10-02 10:20:46 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-10-04 11:23:12 +0200
commit4f8a4a5c04ea85c8b79c2caf1c92683dbf9aba07 (patch)
tree9d6514266e174e78cbe121436d61bf6bd5075fc9
parentf3b29d9327aef74bcd5668c4a7377513c9b16b11 (diff)
Fix compilation
- Some compilers don't like using QPointer in connect(). Use QPointer::data() instead. This fixes the build for linux SLES 12. - Enable simplecoapclient example only when Qt is compiled with gui. Fixes: QTBUG-78884 Change-Id: I592e52eaea93f8f94a2b1af18ea29e745c44dde9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--examples/coap/coap.pro6
-rw-r--r--src/coap/qcoapprotocol.cpp4
-rw-r--r--src/coap/qcoapqudpconnection.cpp12
3 files changed, 12 insertions, 10 deletions
diff --git a/examples/coap/coap.pro b/examples/coap/coap.pro
index 006c281..befe3b7 100644
--- a/examples/coap/coap.pro
+++ b/examples/coap/coap.pro
@@ -1,8 +1,8 @@
TEMPLATE = subdirs
-SUBDIRS += \
- simplecoapclient \
- consolecoapclient
+SUBDIRS += consolecoapclient
+
+qtHaveModule(gui) SUBDIRS += simplecoapclient
qtHaveModule(quick) {
SUBDIRS += \
diff --git a/src/coap/qcoapprotocol.cpp b/src/coap/qcoapprotocol.cpp
index 42ef4ba..9d365c6 100644
--- a/src/coap/qcoapprotocol.cpp
+++ b/src/coap/qcoapprotocol.cpp
@@ -139,14 +139,14 @@ void QCoapProtocol::sendRequest(QPointer<QCoapReply> reply, QCoapConnection *con
|| !QCoapRequestPrivate::isUrlValid(reply->request().url()))
return;
- connect(reply, &QCoapReply::aborted, this, [this](const QCoapToken &token) {
+ connect(reply.data(), &QCoapReply::aborted, this, [this](const QCoapToken &token) {
Q_D(QCoapProtocol);
d->onRequestAborted(token);
});
auto internalRequest = QSharedPointer<QCoapInternalRequest>::create(reply->request(), this);
internalRequest->setMaxTransmissionWait(maximumTransmitWait());
- connect(reply, &QCoapReply::finished, this, &QCoapProtocol::finished);
+ connect(reply.data(), &QCoapReply::finished, this, &QCoapProtocol::finished);
if (internalRequest->isMulticast()) {
connect(internalRequest.data(), &QCoapInternalRequest::multicastRequestExpired, this,
diff --git a/src/coap/qcoapqudpconnection.cpp b/src/coap/qcoapqudpconnection.cpp
index ebb3fa9..41224a2 100644
--- a/src/coap/qcoapqudpconnection.cpp
+++ b/src/coap/qcoapqudpconnection.cpp
@@ -113,15 +113,17 @@ QCoapQUdpConnection::QCoapQUdpConnection(QCoapQUdpConnectionPrivate &dd, QObject
configuration.setPeerVerifyMode(QSslSocket::VerifyNone);
d->dtls->setDtlsConfiguration(configuration);
- connect(d->dtls, &QDtls::pskRequired, this, &QCoapQUdpConnection::pskRequired);
- connect(d->dtls, &QDtls::handshakeTimeout, this, &QCoapQUdpConnection::handshakeTimeout);
+ connect(d->dtls.data(), &QDtls::pskRequired, this, &QCoapQUdpConnection::pskRequired);
+ connect(d->dtls.data(), &QDtls::handshakeTimeout,
+ this, &QCoapQUdpConnection::handshakeTimeout);
break;
case QtCoap::SecurityMode::Certificate:
d->dtls = new QDtls(QSslSocket::SslClientMode, this);
configuration.setPeerVerifyMode(QSslSocket::VerifyPeer);
d->dtls->setDtlsConfiguration(configuration);
- connect(d->dtls, &QDtls::handshakeTimeout, this, &QCoapQUdpConnection::handshakeTimeout);
+ connect(d->dtls.data(), &QDtls::handshakeTimeout,
+ this, &QCoapQUdpConnection::handshakeTimeout);
break;
default:
break;
@@ -145,11 +147,11 @@ void QCoapQUdpConnection::createSocket()
d->udpSocket = new QUdpSocket(this);
- connect(d->udpSocket, &QUdpSocket::readyRead, [this]() {
+ connect(d->udpSocket.data(), &QUdpSocket::readyRead, [this]() {
Q_D(QCoapQUdpConnection);
d->socketReadyRead();
});
- connect(d->udpSocket, QOverload<QAbstractSocket::SocketError>::of(&QUdpSocket::error),
+ connect(d->udpSocket.data(), QOverload<QAbstractSocket::SocketError>::of(&QUdpSocket::error),
[this](QAbstractSocket::SocketError socketError) {
qCWarning(lcCoapConnection) << "CoAP UDP socket error" << socketError
<< socket()->errorString();