]> source.dussan.org Git - tigervnc.git/commitdiff
fix to early remove of iterator in VNCServerST::removeSocket 863/head
authorBenoit Gschwind <gschwind@gnu-log.net>
Sat, 24 Aug 2019 21:18:53 +0000 (23:18 +0200)
committerBenoit Gschwind <gschwind@gnu-log.net>
Sat, 24 Aug 2019 21:21:13 +0000 (23:21 +0200)
common/rfb/VNCServerST.cxx

index a3655bca4b99bbd77627d19a8466d89613abef62..a764f1bca479d4d8e3212e9796a1a066f8534e1b 100644 (file)
@@ -165,8 +165,6 @@ void VNCServerST::removeSocket(network::Socket* sock) {
   std::list<VNCSConnectionST*>::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);