Создаю asio::io_service, передаю его как reference вниз классу, который на нем открывает socket.
При разрушении всей этой хуйни разрушается io_service, а потом пытается разрушиться socket и радостно вычитвает данные по освобожденной памяти.
Это буст говно или я тупой и так делать нельзя? Ведь не спроста в basic_datagram_socket в конструкторе io_service передается не по const ref, а по обычному?
==2865==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000535538 at pc 0x560b6cf18d1b bp 0x7ffce4792370 sp 0x7ffce4792368
READ of size 8 at 0x604000535538 thread T0
#0 0x560b6cf18d1a in boost::asio::detail::reactive_socket_service_base::destroy(boost::asio::detail::reactive_socket_service_base::base_implementation_type&) /usr/include/boost/asio/deta
il/impl/reactive_socket_service_base.ipp:87
#1 0x560b6cf1f330 in boost::asio::datagram_socket_service<boost::asio::ip::udp>::destroy(boost::asio::detail::reactive_socket_service<boost::asio::ip::udp>::implementation_type&) /usr/in
clude/boost/asio/datagram_socket_service.hpp:138
#2 0x560b6cf1f0d5 in boost::asio::basic_io_object<boost::asio::datagram_socket_service<boost::asio::ip::udp>, true>::~basic_io_object() /usr/include/boost/asio/basic_io_object.hpp:197
#3 0x560b6cf1de95 in boost::asio::basic_socket<boost::asio::ip::udp, boost::asio::datagram_socket_service<boost::asio::ip::udp> >::~basic_socket() /usr/include/boost/asio/basic_socket.hp
p:1512
#4 0x560b6cf1cfab in boost::asio::basic_datagram_socket<boost::asio::ip::udp, boost::asio::datagram_socket_service<boost::asio::ip::udp> >::~basic_datagram_socket() /usr/include/boost/as
io/basic_datagram_socket.hpp:43
0x604000535538 is located 40 bytes inside of 48-byte region [0x604000535510,0x604000535540)
freed by thread T0 here:
#0 0x7fcfdc9d21f0 in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc31f0)
#1 0x560b6cf26daf in boost::asio::datagram_socket_service<boost::asio::ip::udp>::~datagram_socket_service() /usr/include/boost/asio/datagram_socket_service.hpp:40
#2 0x560b6cf149fa in boost::asio::detail::service_registry::destroy(boost::asio::io_service::service*) /usr/include/boost/asio/detail/impl/service_registry.ipp:101
#3 0x560b6cf1493a in boost::asio::detail::service_registry::~service_registry() /usr/include/boost/asio/detail/impl/service_registry.ipp:45
#4 0x560b6cf17963 in boost::asio::io_service::~io_service() /usr/include/boost/asio/impl/io_service.ipp:53