diff --git a/src/app/qtsingleapplication/qtlocalpeer.cpp b/src/app/qtsingleapplication/qtlocalpeer.cpp index c7ce52762..f3c4546b6 100644 --- a/src/app/qtsingleapplication/qtlocalpeer.cpp +++ b/src/app/qtsingleapplication/qtlocalpeer.cpp @@ -176,8 +176,17 @@ void QtLocalPeer::receiveConnection() if (!socket) return; - while (socket->bytesAvailable() < (int)sizeof(quint32)) + while (true) { + if (socket->state() == QLocalSocket::UnconnectedState) { + qWarning("QtLocalPeer: Peer disconnected"); + delete socket; + return; + } + if (socket->bytesAvailable() >= qint64(sizeof(quint32))) + break; socket->waitForReadyRead(); + } + QDataStream ds(socket); QByteArray uMsg; quint32 remaining;