aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordail8859 <dail8859@yahoo.com>2020-12-22 20:49:50 -0500
committerdail8859 <dail8859@yahoo.com>2020-12-22 21:03:10 -0500
commit99cd51d5a23b70a4dce2ddd7270320376c07fa56 (patch)
treee22b281de77e37083717c20778dfb2bbabaf6c1c
parentMerge pull request #124 from Shatur95/use-const-reference (diff)
downloadsingleapplication-99cd51d5a23b70a4dce2ddd7270320376c07fa56.tar.xz
Remove ConnectionInfo after socket is destroyed
This leaves the ConnectionInfo in a valid state, even after the socket is disconnected, which could still have a readyRead() signal emitted. Closes #123
-rw-r--r--singleapplication_p.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp
index 1ab58c2..70edaae 100644
--- a/singleapplication_p.cpp
+++ b/singleapplication_p.cpp
@@ -328,10 +328,12 @@ void SingleApplicationPrivate::slotConnectionEstablished()
}
);
- QObject::connect(nextConnSocket, &QLocalSocket::disconnected,
- [nextConnSocket, this](){
+ QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater);
+
+ QObject::connect(nextConnSocket, &QLocalSocket::destroyed,
+ [nextConnSocket, this](QObject *obj){
+ Q_UNUSED(obj)
connectionMap.remove(nextConnSocket);
- nextConnSocket->deleteLater();
}
);