From 4052d37110a9a492be385e95d0bd25aebe7cf200 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 26 Mar 2021 00:16:25 +0100 Subject: [PATCH] Fix signal-slot issues --- singleapplication_p.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp index e65bd95..0bde5ef 100644 --- a/singleapplication_p.cpp +++ b/singleapplication_p.cpp @@ -321,22 +321,22 @@ void SingleApplicationPrivate::slotConnectionEstablished() QLocalSocket *nextConnSocket = server->nextPendingConnection(); connectionMap.insert(nextConnSocket, ConnectionInfo()); - QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, + QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, [nextConnSocket, this](){ auto &info = connectionMap[nextConnSocket]; - Q_EMIT this->slotClientConnectionClosed( nextConnSocket, info.instanceId ); + this->slotClientConnectionClosed( nextConnSocket, info.instanceId ); } ); QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater); - QObject::connect(nextConnSocket, &QLocalSocket::destroyed, + QObject::connect(nextConnSocket, &QLocalSocket::destroyed, this, [nextConnSocket, this](){ connectionMap.remove(nextConnSocket); } ); - QObject::connect(nextConnSocket, &QLocalSocket::readyRead, + QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, [nextConnSocket, this](){ auto &info = connectionMap[nextConnSocket]; switch(info.stage){ @@ -347,7 +347,7 @@ void SingleApplicationPrivate::slotConnectionEstablished() readInitMessageBody(nextConnSocket); break; case StageConnected: - Q_EMIT this->slotDataAvailable( nextConnSocket, info.instanceId ); + this->slotDataAvailable( nextConnSocket, info.instanceId ); break; default: break; @@ -449,7 +449,7 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock ) } if (sock->bytesAvailable() > 0){ - Q_EMIT this->slotDataAvailable( sock, instanceId ); + this->slotDataAvailable( sock, instanceId ); } } @@ -462,7 +462,7 @@ void SingleApplicationPrivate::slotDataAvailable( QLocalSocket *dataSocket, quin void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedSocket, quint32 instanceId ) { if( closedSocket->bytesAvailable() > 0 ) - Q_EMIT slotDataAvailable( closedSocket, instanceId ); + slotDataAvailable( closedSocket, instanceId ); } void SingleApplicationPrivate::randomSleep()