Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // We are using boost 1_67_0
- // We have this code:
- auto channel = boost::make_shared<Channel>(host, port, user, pass, vhost, 131072);
- // And it crashes at run-time in make_shared. The crash occurs here:
- template< class T, class... Args > typename boost::detail::sp_if_not_array< T >::type make_shared( Args && ... args )
- {
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
- boost::detail::sp_ms_deleter< T > * pd = static_cast<boost::detail::sp_ms_deleter< T > *>( pt._internal_get_untyped_deleter() );
- void * pv = pd->address();
- ::new( pv ) T( boost::detail::sp_forward<Args>( args )... );
- pd->set_initialized(); // <---------------------------------- HERE
- T * pt2 = static_cast< T* >( pv );
- boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
- return boost::shared_ptr< T >( pt, pt2 );
- }
- //The declaration of Channel can be found here:
- https://github.com/alanxz/SimpleAmqpClient/blob/master/src/SimpleAmqpClient/Channel.h
- //The definition is here:
- https://github.com/alanxz/SimpleAmqpClient/blob/master/src/Channel.cpp
- // We also tried making our own dummy struct to se if we could reproduce the crash, but it runs fine:
- struct lolbob {
- std::string host;
- int port;
- std::string user;
- std::string pass;
- std::string vhost;
- explicit lolbob(const std::string &host,int port, const std::string &user, const std::string &pass, const std::string &vhost)
- : host(host)
- , port(port)
- , user(user)
- , pass(pass)
- , vhost(vhost)
- {
- std::cout << "lolbob ctor host=" << host << ", user=" << user << ", pass=" << pass << ", virtualhost=" << vhost << endl;
- }
- };
- auto bahn=boost::make_shared<lolbob>(host, port, user, pass, vhost );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement