Explorar el Código

Allow delete this in onclose callback for #496

ithewei hace 1 año
padre
commit
90e3b2fa13
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      evpp/TcpClient.h

+ 2 - 2
evpp/TcpClient.h

@@ -154,11 +154,11 @@ public:
             }
             }
         };
         };
         channel->onclose = [this]() {
         channel->onclose = [this]() {
+            bool reconnect = reconn_setting != NULL;
             if (onConnection) {
             if (onConnection) {
                 onConnection(channel);
                 onConnection(channel);
             }
             }
-            // reconnect
-            if (reconn_setting) {
+            if (reconnect) {
                 startReconnect();
                 startReconnect();
             }
             }
         };
         };