diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-12-07 19:02:41 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-01-20 12:42:46 +0000 |
commit | 212c3c4f122ea921336137c7987a9c866c5cc347 (patch) | |
tree | b0b98f5edb468e7569c0d7bbe5042524efcc829d /src | |
parent | 766cd66f40f494642a1f83646299920e118eac4b (diff) |
RemoteObject: Fix warning on calling QLocalSocket::waitForDisconnected()
Change-Id: I1d5fdfedaee35c530b383951e6fc69b75bd67d64
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/remoteobject.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libs/installer/remoteobject.cpp b/src/libs/installer/remoteobject.cpp index f6f0f2bfe..7c875b183 100644 --- a/src/libs/installer/remoteobject.cpp +++ b/src/libs/installer/remoteobject.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -58,7 +58,8 @@ RemoteObject::~RemoteObject() { if (m_socket) { if (QThread::currentThread() == m_socket->thread()) { - if (m_type != QLatin1String("RemoteClientPrivate")) { + if ((m_type != QLatin1String("RemoteClientPrivate")) + && (m_socket->state() == QLocalSocket::ConnectedState)) { writeData(QLatin1String(Protocol::Destroy), m_type, dummy, dummy); while (m_socket->bytesToWrite()) { // QAbstractSocket::waitForBytesWritten() may fail randomly on Windows, use @@ -67,7 +68,9 @@ RemoteObject::~RemoteObject() connect(m_socket, &QLocalSocket::bytesWritten, &loop, &QEventLoop::quit); loop.exec(); } - if (!m_socket->waitForDisconnected()) { + m_socket->disconnectFromServer(); + if (!(m_socket->state() == QLocalSocket::UnconnectedState + || m_socket->waitForDisconnected())) { qCWarning(lcServer) << "Error while disconnecting from remote server:" << m_socket->error(); } |