[Client] Drain a single-instance payload before its handlers read the socket again

This commit is contained in:
Lukas Brübach 2026-09-19 07:20:50 +02:00 committed by GitHub
parent d8cc5522f2
commit 040be0c1d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -134,12 +134,15 @@ void SingleInstanceManager::handleNewConnection()
socket->write(ACK_MESSAGE);
socket->flush();
emit filesReceived(files);
// Reset buffer (single message use-case)
// Drop the payload from the buffer before handling it: the handlers
// run synchronously and can spin a nested event loop (e.g. a modal
// dialog) that re-reads this socket, which would re-parse and re-emit
// the same files.
buffer->clear();
*expectedSize = 0;
emit filesReceived(files);
socket->disconnectFromServer();
return;
}