From 06aeb8ea9f60d474ce64bc2004433c17a4ce6b78 Mon Sep 17 00:00:00 2001 From: dejaniv Date: Thu, 11 Jul 2019 18:15:21 -0700 Subject: [PATCH] Fix issue #1171: Order of object destruction (#1175) - Connection object is now destroyed before client object - Client is destroyed only when wspp_callback_client is destroyed to prevent race condition with the destructor --- Release/src/websockets/client/ws_client_wspp.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Release/src/websockets/client/ws_client_wspp.cpp b/Release/src/websockets/client/ws_client_wspp.cpp index 5ef74aaf1e..26fa547d5d 100644 --- a/Release/src/websockets/client/ws_client_wspp.cpp +++ b/Release/src/websockets/client/ws_client_wspp.cpp @@ -689,9 +689,6 @@ class wspp_callback_client : public websocket_client_callback_impl, } } // unlock - // Delete client to make sure Websocketpp cleans up all Boost.Asio portions. - m_client.reset(); - if (connecting) { websocket_exception exc(ec, build_error_msg(ec, "set_fail_handler")); @@ -801,8 +798,6 @@ class wspp_callback_client : public websocket_client_callback_impl, websocketpp::client m_client; }; - websocketpp::connection_hdl m_con; - pplx::task_completion_event m_connect_tce; pplx::task_completion_event m_close_tce; @@ -810,6 +805,7 @@ class wspp_callback_client : public websocket_client_callback_impl, std::mutex m_wspp_client_lock; State m_state; std::unique_ptr m_client; + websocketpp::connection_hdl m_con; // Queue to track pending sends outgoing_msg_queue m_out_queue;