From 8e09912f9d66e5bef8146040b366286c661e3b53 Mon Sep 17 00:00:00 2001 From: Benoit Gschwind Date: Sat, 24 Aug 2019 23:18:53 +0200 Subject: [PATCH] fix to early remove of iterator in VNCServerST::removeSocket --- common/rfb/VNCServerST.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index a3655bca..a764f1bc 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -165,8 +165,6 @@ void VNCServerST::removeSocket(network::Socket* sock) { std::list::iterator ci; for (ci = clients.begin(); ci != clients.end(); ci++) { if ((*ci)->getSock() == sock) { - clients.remove(*ci); - // - Remove any references to it if (pointerClient == *ci) pointerClient = NULL; @@ -182,6 +180,8 @@ void VNCServerST::removeSocket(network::Socket* sock) { // - Delete the per-Socket resources delete *ci; + clients.remove(*ci); + CharArray name; name.buf = sock->getPeerEndpoint(); connectionsLog.status("closed: %s", name.buf); -- 2.39.5