summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects
diff options
context:
space:
mode:
Diffstat (limited to 'src/remoteobjects')
-rw-r--r--src/remoteobjects/qconnection_tcpip_backend.cpp17
-rw-r--r--src/remoteobjects/qremoteobjectreplica.cpp6
2 files changed, 13 insertions, 10 deletions
diff --git a/src/remoteobjects/qconnection_tcpip_backend.cpp b/src/remoteobjects/qconnection_tcpip_backend.cpp
index 42b3d85..f99ee9e 100644
--- a/src/remoteobjects/qconnection_tcpip_backend.cpp
+++ b/src/remoteobjects/qconnection_tcpip_backend.cpp
@@ -81,14 +81,15 @@ void TcpClientIo::connectToServer()
{
if (isOpen())
return;
- QHostAddress address(url().host());
- if (address.isNull()) {
- const QList<QHostAddress> addresses = QHostInfo::fromName(url().host()).addresses();
- Q_ASSERT_X(addresses.size() >= 1, Q_FUNC_INFO, url().toString().toLatin1().data());
- address = addresses.first();
- }
-
- m_socket->connectToHost(address, url().port());
+ const QString &host = url().host();
+ QHostAddress address(host);
+ if (address.isNull())
+ address = QHostInfo::fromName(host).addresses().value(0);
+
+ if (address.isNull())
+ qWarning("connectToServer(): Failed to resolve host %s", qUtf8Printable(host));
+ else
+ m_socket->connectToHost(address, url().port());
}
bool TcpClientIo::isOpen() const
diff --git a/src/remoteobjects/qremoteobjectreplica.cpp b/src/remoteobjects/qremoteobjectreplica.cpp
index ddfe3ec..4eae1e9 100644
--- a/src/remoteobjects/qremoteobjectreplica.cpp
+++ b/src/remoteobjects/qremoteobjectreplica.cpp
@@ -146,8 +146,10 @@ QConnectedReplicaImplementation::~QConnectedReplicaImplementation()
sendCommand();
}
for (auto prop : m_propertyStorage) {
- if (prop.canConvert<QObject*>())
- prop.value<QObject *>()->deleteLater();
+ if (prop.canConvert<QObject*>()) {
+ if (auto o = prop.value<QObject*>())
+ o->deleteLater();
+ }
}
}