aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/src/nxmhandler_linux.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/src/nxmhandler_linux.cpp b/src/src/nxmhandler_linux.cpp
index c7db527..7b70ff4 100644
--- a/src/src/nxmhandler_linux.cpp
+++ b/src/src/nxmhandler_linux.cpp
@@ -301,12 +301,20 @@ void NxmHandlerLinux::onNewConnection()
void NxmHandlerLinux::processSocketData(QLocalSocket* socket)
{
+ // Drain all available lines before emitting anything. Slot handlers for
+ // nxmReceived/directDownloadReceived can show modal dialogs (e.g. the
+ // "Wrong Game" warning) that spin the event loop. That re-entry would
+ // process the disconnected → deleteLater queued for this socket and free
+ // it, leaving the canReadLine() loop iterating on a dangling pointer.
+ QStringList lines;
while (socket->canReadLine()) {
const QString line = QString::fromUtf8(socket->readLine()).trimmed();
- if (line.isEmpty()) {
- continue;
+ if (!line.isEmpty()) {
+ lines.append(line);
}
+ }
+ for (const QString& line : lines) {
log::info("received link on socket: {}", line);
// Try NXM-style parse first (nxm:// or modl:// with /mods/ID/files/ID path).