Fix crash in SingleApplication when other end exits immediately

In those cases the emit might cause the server to remove the connection
and we are working with a dangling pointer. We can't call putChar on
that, so acknowledge the message immediately and then emit the message.
This commit is contained in:
Nicolas Werner 2021-11-24 05:21:30 +01:00
parent ff502f306c
commit 07e187d4d8
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 2 additions and 2 deletions

View File

@ -494,12 +494,12 @@ void SingleApplicationPrivate::slotDataAvailable( QLocalSocket *dataSocket, quin
if ( !isFrameComplete( dataSocket ) )
return;
Q_EMIT q->receivedMessage( instanceId, dataSocket->readAll() );
writeAck( dataSocket );
ConnectionInfo &info = connectionMap[dataSocket];
info.stage = StageConnectedHeader;
Q_EMIT q->receivedMessage(instanceId, dataSocket->readAll());
}
void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedSocket, quint32 instanceId )