We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c5b5492 + 337bf2f commit fe00a84Copy full SHA for fe00a84
websocketpp/transport/asio/connection.hpp
@@ -443,8 +443,15 @@ class connection : public config::socket_type::socket_con_type {
443
m_async_write_handler = lib::bind(&type::handle_async_write,
444
get_shared(), lib::placeholders::_1, lib::placeholders::_2);
445
}
446
-
447
- return socket_con_type::init_asio(io_service, m_strand, m_is_server);
+
+ lib::error_code ec = socket_con_type::init_asio(io_service, m_strand, m_is_server);
448
+ if (ec) {
449
+ // reset the handlers to break the circular reference: this->handler->this
450
+ m_async_read_handler = _WEBSOCKETPP_NULLPTR_TOKEN_;
451
+ m_async_write_handler = _WEBSOCKETPP_NULLPTR_TOKEN_;
452
+ }
453
454
+ return ec;
455
456
457
void handle_pre_init(lib::error_code const & ec) {
0 commit comments