From eb291db1c813f69c8b8bcb4900fa18d827f7c12e Mon Sep 17 00:00:00 2001 From: Benjamin Jemlich Date: Wed, 4 Jan 2012 14:11:58 +0100 Subject: [PATCH] Workaround for missing disconnected signals on Windows Sometimes Qt doesn't emit a disconnected signal for closed sockets (or it happens before we're listening to those). Manually emitting the signal in our disconnect function if the socket is not connected fixes the problem. --- src/Connection.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Connection.cpp b/src/Connection.cpp index ab65a1961..f2351b49a 100644 --- a/src/Connection.cpp +++ b/src/Connection.cpp @@ -214,6 +214,11 @@ void Connection::forceFlush() { } void Connection::disconnectSocket(bool force) { + if (qtsSocket->state() == QAbstractSocket::UnconnectedState) { + emit connectionClosed(QAbstractSocket::UnknownSocketError, QString()); + return; + } + if (force) qtsSocket->abort(); else